my dog learned polymorphism*
The moose likes Websphere and the fly likes Betterway to use global variable in webapplication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Betterway to use global variable in webapplication" Watch "Betterway to use global variable in webapplication" New topic
Author

Betterway to use global variable in webapplication

Swathi Sri
Greenhorn

Joined: Jan 18, 2007
Posts: 22
Hi All,

I am looking for how to use global variables in my web application.
I have properties file in database and thus whenever required, we retrieve from database. All properties are alomost readonly. Once in a while they get changed in database. Thus server restart is not a problem when any value gets changed.

Inorder to increase the performance, I am planning to use global variables for all properties which will make properties available through out the application and reduce the database interaction.

I have an idea of using Static class to save the values and access these values. This is a webapplication and exists in Websphere server.

Can anybody give me better ways of solving the problem and any flaws of using static class for this purpose.

Thanks & Regards,
Swathi.
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
You may use Servlet Context initialization parameters for this purpose. They are set up in the web.xml file
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Betterway to use global variable in webapplication
 
Similar Threads
How do we use global variables in servlets?
Betterway to use global variable
Betterway to use global variable
Betterway to use global variable in webapplication
where to put the properties file in WebLogic10 server web & Hibernate application