• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServletContext attributes from non-servlet class?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic