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
http://java.sun.com/products/servlet/download.html
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