{i} Questions on How To Implement Application Startup/Shutdown Behaviour have come up a number of times on the user list - hence this page.
N.B. See also the StrutsInitialization page.
Struts PlugIn
The Struts PlugIn provides implementation points for the application startup and shutdown phases. Struts was developed in a Servlet 2.2 environment which provided no such equivalent mechanism.
PlugIn or ServletContextListener?
In a Servlet 2.2 environment then the only choice is a PlugIn (or using a Startup Servlet).
The Servlet 2.3 specification introduced the ServletContextListener which provides the same facilities. Rather than repeat other peoples words, below are some points from a recent thread:
- 1 ServletContextListener is portable
- 2 Servlet Unloads (and also here).
If you want to know how to use a ServletContextListener then See this post.