tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kitching Simon <Simon.Kitch...@orange.ch>
Subject RE: context initialization
Date Wed, 27 Dec 2000 10:16:23 GMT
If I understand your question correctly, I do this sort of
thing currently, by having a servlet which instantiates 
a bunch of objects, and adds them to the context.
This servlet is defined as "load-on-startup".


In the webapp's web.xml, I have:

    <!-- define a servlet/class that can be accessed by all other components
-->
    <servlet>
        <servlet-name>initializerServlet</servlet-name>
        <servlet-class>orange.ola3.InitializerServlet</servlet-class>
        <load-on-startup>1</load-on-startup>

        <init-param>
          <!-- set system state mode. Valid values are:
               PRODUCTION, TEST, DEBUG
          -->

          <param-name>systemStateMode</param-name>
          <param-value>DEBUG</param-value>
        </init-param>
    </servlet>

In reality, I have a whole bunch more init-param tags, containing things
like JDBC connection strings.
The servlet code itself does a bunch of things like:

          systemState = new SystemState();
          context.setAttribute("systemState", systemState);

Regards,

Simon

> -----Original Message-----
> From:	Nicolás Marjovsky [SMTP:nmarjovs@insite.com.ar]
> Sent:	Tuesday, December 26, 2000 10:40 PM
> To:	tomcat-user@jakarta.apache.org
> Subject:	context initialization
> 
> Hello,
> I need to put some static objects into a web application context at
> start-up time... I want to set the context when the application is going
> up. Where should I put this? In web.xml?
>  
> Thanks,
> Nicolás

Mime
View raw message