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

Re: placing the properties file in tomcat


I am not sure how the misunderstanding occured, but my application is based on
struts framework.  but what you suggested for servelts also seems quite logical
to me and can be used within struts, although i might be breaking out of the
'proper' framework. so i guess now i should ask, will i break a big struts norm
in using your third suggestion. and again if i want to go the init-param way.
can you once more explain how i will use the properties globally. Essentially
the same solution that you have provided here but in the struts framework. 

once again, please bear with me. this is taking longer to sink in than i
thought and  hoped. i am reading up on servlets and struts to brush up some of
my fundamentals. 

thank you
--- Kamesh Challa <kamesh@netexpress.net> wrote:
> Poorav, 
> The init-param was basically for the Struts framework but not part of the 
> servlet parameters. 
>  So, basically you're looking for an alternative to access the global
> property 
> file across the board. Correct?? 
> Well, there are many methods to configure the global properties. Let's
> discuss 
> some of the them for better understanding. 
> 1. You could configure them within the property xml files of the servers 
> (weblogic or tomcat or what ever your server may be) and get the values from 
> the context. (I would not suggest this method) 
> 2. Create an interface class and store the values within the interface as
> final 
> variables and hence available where ever you want. (I would not suggest this 
> method too. Not scalable at all) 
> 3. One of the better methods I'd suggest: 
>    - Create the external property object as you've created already. 
>    - Create a class which makes use of the ResourceBundle to load the 
> properties in the constructor of the object
>    - Have static methods to get the property values from the resource bundle.
>    - Use this class where ever you want. 
> This should be simple enough. 
> If you want to know more about ResourceBundle class
> http://java.sun.com/docs/books/tutorial/i18n/resbundle/concept.html
> and how to use with property file at:
> http://java.sun.com/docs/books/tutorial/i18n/resbundle/propfile.html
> Hope this is of some help...
> Thanks and BR, 
> --Kamesh Challa
> Yash Technologies Inc.

Poorav Chaudhari

Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more