[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
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@yahoo.com> 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@netexpress.net>
> 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@yahoo.com>:
> >
> >> 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
> >>
> >
>
>
>
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>
=====
Poorav Chaudhari
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com