• Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext attributes from non-servlet class?  RSS feed

 
Jeff Vendetti
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet, InitParams, that starts up with the server and puts a property object in the context and is nicely available from all the servlets. However, I have a series of utility classes in a different package that are not servlets that are called from the servlets. What's the easiest way to have those classes get access to the Properties object? The only way I can think of is to pass the Properties object to each and every one of these methods. There must be a better way. Any help appreciated. Thanks
 
Jeff Vendetti
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I figured out how to do it. I set up a singleton class which I use to put the properties in from the InitParams servlet. Then, this class is available from any of the utility classes as well as from all the servlets.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!