Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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
 
Consider Paul's rocket mass heater.
 
subject: reload collections that initialized on startup?