Poorav Chaudhari | 1 Apr 18:50 2003
Picon

placing the properties file in tomcat

For my web application, i have created a properties file. It is placed in the
WEB-INF/classes folder. to test the properties file i also created a small
command line program. that worked fine, i was able to print the values of
properties. but when i run the web app on tomcat, i get an error saying that
the properties file cannot be found. what am i missing. 

Thank you in advance.

=====
Poorav Chaudhari

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com

Poorav Chaudhari | 1 Apr 18:53 2003
Picon

placing the properties file in tomcat

For my web application, i have created a properties file. It is placed in the
WEB-INF/classes folder. to test the properties file i also created a small
command line program. that worked fine, i was able to print the values of
properties. but when i run the web app on tomcat, i get an error saying that
the properties file cannot be found. what am i missing. 

Thank you in advance.

=====
Poorav Chaudhari

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com

Kamesh Challa | 1 Apr 19:28 2003
Picon

Re: placing the properties file in tomcat

Couple of methods. 
1. Use 
ResourceBundle rBundle = ResourceBundle.getBundle("<your property file name>");
rBundle.getString("<Your property name>");

2. Use:
init parameters within your web.xml and use it. (Struts applications are 
classic examples) 

I remember some examples within the samples given under tomcat. Check it out. 

HTH...

Thanks, 
--Kamesh Challa
Yash Technologies Inc.

Quoting Poorav Chaudhari <pooravc@...>:

> For my web application, i have created a properties file. It is placed in
> the
> WEB-INF/classes folder. to test the properties file i also created a small
> command line program. that worked fine, i was able to print the values of
> properties. but when i run the web app on tomcat, i get an error saying
> that
> the properties file cannot be found. what am i missing. 
> 
> Thank you in advance.
> 
> 
(Continue reading)

Calvin Yu | 1 Apr 20:58 2003
Picon

Re: placing the properties file in tomcat


Here's how you load it up as a Properties object:

1. ServletContext.getResourceAsStream("/WEB-INF/classes/foo.properties");

2. Object.getClass().getClassLoader("foo.properties");

Calvin

On Tue,  1 Apr 2003 12:28:34 -0500, Kamesh Challa <kamesh@...> 
wrote:

> Couple of methods. 1. Use ResourceBundle rBundle = 
> ResourceBundle.getBundle("<your property file name>");
> rBundle.getString("<Your property name>");
>
> 2. Use:
> init parameters within your web.xml and use it. (Struts applications are 
> classic examples)
>
> I remember some examples within the samples given under tomcat. Check it 
> out.
>
> HTH...
>
> Thanks, --Kamesh Challa
> Yash Technologies Inc.
>
>
> Quoting Poorav Chaudhari <pooravc@...>:
(Continue reading)

Poorav Chaudhari | 1 Apr 23:01 2003
Picon

Re: placing the properties file in tomcat

I have a feeling i am missing the jist of how to use properties. I read the
short tutorial on using properties to manage program attributes. but in that it
is explained with the use of a standalone application. The use and
implementation of properties in a servlet environment seems to be a completely
different ball game. my application is specifically in struts framework. now
the properties that i define in the properties file, will be used through out
the application. can i find some sort of discussion on this online? something
that will help me clarify this confusion? Thanks.

Poorav

--- Calvin Yu <cyu77@...> wrote:
> 
> Here's how you load it up as a Properties object:
> 
> 1. ServletContext.getResourceAsStream("/WEB-INF/classes/foo.properties");
> 
> 2. Object.getClass().getClassLoader("foo.properties");
> 
> Calvin
> 
> 
> On Tue,  1 Apr 2003 12:28:34 -0500, Kamesh Challa <kamesh@...> 
> wrote:
> 
> > Couple of methods. 1. Use ResourceBundle rBundle = 
> > ResourceBundle.getBundle("<your property file name>");
> > rBundle.getString("<Your property name>");
> >
> > 2. Use:
(Continue reading)

Kamesh Challa | 2 Apr 00:30 2003
Picon

Re: placing the properties file in tomcat


Poorav,
    If I understand it correctly you want to understand where/how you'd use 
properties file within your STRUTS based application. 

If so.. read ahead... 

One of the frequent uses of property files within STRUTS FRAMEWORK is to 
customize/standardize error messages across the application. 

Let's take an example of defining system wide error messages for clarity.

You'd have to do 4 basic things to accomplish this:

1. Define error messages in a property file as key value pairs (The usual way;-
)). 

Eg: Say you've ApplicationResources.properties file that had the error messages 
defined 

error.last_name.required=<li><b>Last name</b> is required</li>

Note: Generally HTML tags are included along with the error messages to be 
prominent. 

2. Use the error messages to populate the org.apache.struts.action.ActionErrors 
object in case of validation fails in your Application Action Form via the 
validate method.  

Eg: You may do something like this in your application Action Form in the 
(Continue reading)

web dev | 2 Apr 00:33 2003
Picon

messaging Vs RPC

hi all,
   I am a little confused about the difference between
soap messaging vs rpc to access a web service.
   -when to use messaging and when to use rpc.
   -can the same wsdl file be used to generate stubs
in both the cases?

thanks
Raj

Kamesh Challa | 2 Apr 01:04 2003
Picon

Re: messaging Vs RPC


Here's a simple explanation:

SOAP Document Model is for asynchronous processing. 
SOAP RPC Modle is for Synchrounus processing. 

HTH.... 

Thanks and BR, 
--Kamesh Challa
Yash Technologies Inc.

Quoting web dev <programming95@...>:

> hi all,
>    I am a little confused about the difference between
> soap messaging vs rpc to access a web service.
>    -when to use messaging and when to use rpc.
>    -can the same wsdl file be used to generate stubs
> in both the cases?
> 
> thanks
> Raj
> 
> 

Poorav Chaudhari | 2 Apr 19:09 2003
Picon

Re: placing the properties file in tomcat

Kamesh,

Thanks for shedding some light, but now i have a few more questions. Please
bear with me. you can possibly show me the first few steps of how i should
approach my problem. I am already using the application.resources file for my
displaying errors, although i must admit it's inner working i have yet to fully
understand. anywho, now i would like to make the use of another properties file
that stores things like paths to certain files, server name etc. These
obviously i need at various points in the application. let this property file
be app.properties. from what i understood,  i can place this file in the
/WEB-INF/classes folder and i my entry for it in the web.xml will be something
like

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

    <init-param>
      <param-name>application</param-name>
      <param-value>app.properties</param-value>
    </init-param>

    <load-on-startup>1</load-on-startup>
  </servlet>

I don't know what to substitute servlet-name and servlet-class with. and again,
how do i access these properties from my beans and jsps. 

I did look at the java.util.ResourceBundle, but that didn'tdo much except for
give me a conceptual understanding of the usage of resourcebundle. 
(Continue reading)

Jennifer Fisher | 2 Apr 20:21 2003
Picon

Interfaces, abstract classes. Why?

Hi all.  I hope someone can help me understand better.

What are the uses for interfaces and abstract classes?  Why would one need them in a project and what for?

Thank you in advance.

Jennifer Fisher
Developer, Gaye Systems
IITP 2.0

--

-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


Gmane