Joshua wrote: > I thought I would be slick an attempt to cache the Collections used to > populate my forms drop down list boxes instead of hitting the database every > time (The values may change daily).
Assuming you don't reload (or stop/start) your webapp daily, in which case a ServletContextListener could be employed to place the Collections into application scope where they would live until the next reload... I assume that Struts uses the iterator() method of the Collection/List in order to write out the <option> tags. Maybe it's the toArray() method. In any case... What if you implemented Collection (or List) and held a timestamp, so that when the iterator() method was called, you would check to see if the data was "expired" and if so, go read it from the database before returning the Iterator. That's going to cause a delay for the one person who's unlucky enough to request the page after the expiration, but if you stagger the expiration times, it'll only delay one person per day per drop-down. I use the ServletContextListener approach, but the contents of my dropdowns don't change that often. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management

