I believe the preferred method for app initialization at
startup is to use a ServletContextListener. This is a
servlet container (Tomcat) thing, not a Struts thing.
Basically, create a class like this:
import javax.servlet.*;
import org.apache.log4j.Logger;
public final class initApp implements ServletContextListener {
private ServletContext context = null;
static Logger log = Logger.getLogger("initApp");
public void contextInitialized(ServletContextEvent event) {
context = event.getServletContext();
/*
* Gets executed once at app startup...
*/
log.info("INITIALIZING APP...");
// Your init code goes here...
/*
* App is ready to rock and roll.
*/
log.info("APP INIT COMPLETE");
}
public void contextDestroyed(ServletContextEvent event) {
context = event.getServletContext();
/*
* Gets called once when app is unloaded.
*/
log.info("STOPPING APP...");
// Your app unload code goes here
log.info("APP STOPPED");
}
}
Then you need to add this to your web.xml file:
<listener>
<listener-class>initApp</listener-class>
</listener>
Hope this helps!
-Shane
_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>