We have a large collection of lookup tables in our DB that we anticipate using in many applications. Is it possible to have a 'reference app' that fetches a bunch of values and keeps them in memory so they are available to other apps? How do the apps communicate? Thanks.
There is one important distinction - whether or not the various servlets belong to the same "web application" and share the same web.xml and ServletContext. If they are all in the same ServletContext, then you can store named "attribute" references in the ServletContext. One of the major design requirements for the servlet API was keeping web applications cleanly separated. Do these values change during the lifetime of a servlet? Bill
No, they would look up the values, store them in a list or something, and just sit there. they would need to be available to several apps, each with a different context and web.xml. We would them somehow re-run it daily or maybe weekly.
Could I package all of this into a jar file and put it in TOMCAT_HOME/shared/lib ?
Maybe use RMI? (I know nothing about this, but it looks possible) Maybe a web service?
Author and all-around good cowpoke
Joined: Mar 22, 2000
The simplest thing to do would be to save these values as a serialized collection object to a file that all the apps can locate. If you have not done serialization before you will be surprised at how simple it is.
A Map makes a good Collection to organize multiple chunks of data with names as keys - thats the way HttpSession objects handle things.