Ooofff ... off-by-one error warning ... :-)

Quoting "Craig R. McClanahan" <[EMAIL PROTECTED]>:

> 
> If you are in a Servlet 2.4 environment, use a ServletContextListener -- this
> is
> exactly what they are defined to do.  Your contextInitialized() method is
> called once, before any requests are accepted by the app, and
> contextDestroyed() is called exactly once when the app is removed (or the
> server is shut down).

This actually works from Servlet 2.3 onward.

> If you are in a Servlet 2.3 environment, use a Struts PlugIn.  Under most
> scenarios, this will have the same effect (as long as you set the
> load-on-startup attribute in web.xml); however servlet containers are
> allowed
> to unload and reload a servlet during the lifetime of an application, which
> would cause the initialization to be redone at reload.  Fortunately,
> containers
> don't tend to do that -- especially not to a servlet that will get invoked
> as
> often as the Struts controller servlet does.
> 

This advice actually applies to Servlet 2.2 platforms, before
ServletContextListener was part of the standard Servlet spec.

> Craig McClanahan

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to