This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
For reading servlet configuration parameters, you can use the ServletConfig object to retrieve. For reading web application general parameters, use ServletContext instead.
I don't recommend to use catalina.bat to pass in parameters using java program arguments. Firstly, the security manager of the container might prohibit you from getting or setting the property. You will get an SecurityException if you do so. Next, it might require a different approach when your application migrate to other containers. You might also have maintenance issue when there are lots of parameters to configure.
What kind of properties you referring to? If these are application/domain specific parameters, usually it is better to put them in database.
Hope this helps. Cheers. [ November 01, 2006: Message edited by: Eddy Lee Sin Ti ]
SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
Eddy Lee Sin Ti
Joined: Oct 06, 2005
As another thought, you can also use env-entry element in your deployment descriptor to define the environment variable and use JNDI to load them in runtime.
And even more fun if you want to experiment with MBeans to manage your resources like parameters.
Thanks for your Reply. My Requirement is i have a project specific varable.eing it is a singl variable i can not use properties file. Being the file where i want to read that variable is not a servlet i can not use Servlet Context or Servlet Config. If i want put at a place where server reads and provides when i request for that, that solves my problem.