How can I initialize custom “application scope” objects for use in a Struts application?
Location: http://www.jguru.com/faq/view.jsp?EID=471960 Created: Aug 8, 2001 Author: Ted Husted (http://www.jguru.com/guru/viewbio.jsp?EID=462042) One way would be to subclass the ActionServlet, to to initialize whatever application scope objects you might need. Just remember to call the super.init() method! A better approach would be to write another servlet, and auto-load both the Struts controller and your own servlet through the web.xml file. The Example application does this to load a “database” servlet, which is then accessed throughout the application. This way you can initialize application-specific things through your specialized servlet, and leave the normal Struts controller servlet alone. In a servlet 2.3 environment (such as Tomcat 4.0), you will also be able to use the new application event listener APIs to catch the contextInitialized() and contextDestroyed() events. This will become the preferred method, once servlet 2.3 containers are widely available.
- Does the BRMS Application Client use save files to save objects and do I need 1 gigabyte of system storage in order to save a 1 gigabyte database to an TSM server?
- How can I initialize custom "application scope" objects for use in a Struts application?
- Where Are Business Objects In An N-Tier Application?