tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Creating object for the application
Date Mon, 30 Jul 2001 17:45:27 GMT
On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:

> Hi,
> anyone knows how to create an object from the startup of the server and
> make it available for the application. I don't want to call a servlet to
> get it from a JSP page. Is there another way?

In any servlet container that implements 2.2 or later, you can create a
servlet that is marked <load-on-startup> in the web.xml file, and then
create your objects in the init() method of that servlet.  For more info
about web.xml, see the Servlet Specification at

For servlet 2.3 containers (i.e. Tomcat 4.0 for now, others soon), you can
also use the new "Application Event Listener" mechanism to register a
class that is told about the context startup and context shutdown
events.  This is a perfect place to initialize things at startup time.

> Alexis

Craig McClanahan

View raw message