This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes reload collections that initialized on startup? 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 » Java » Servlets
Bookmark "reload collections that initialized on startup?" Watch "reload collections that initialized on startup?" New topic
Author

reload collections that initialized on startup?

Dave Bosky
Ranch Hand

Joined: Dec 16, 2003
Posts: 72
I have a servlet that loads several collections that are using to populate dropdown listbox. Snippet below.


This servlet is configured to load on startup in my web.xml file.
How can I reload this list after I add new values to the list?

Is there a better way to accomplish caching of collections used to populate common listboxes?

Thanks....
Dave
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Is there a better way to accomplish caching of collections used to populate common listboxes?


Yes.
Use a context listener to load the values into either a singlton object or a context scoped bean. Then, have your servlet read from that object at run time.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: reload collections that initialized on startup?
 
Similar Threads
tomcat 5 auto reload : Missing web.xml
Session / Message Driven Beans load sequence
deploying java web application having huge class files
selectManyListbox not setting value
Reloading XML files