[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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@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/