• Post Reply Bookmark Topic Watch Topic
  • New Topic

Betterway to use global variable in webapplication  RSS feed

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may use Servlet Context initialization parameters for this purpose. They are set up in the web.xml file
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!