How to specify a startup servlet for an application (CONTEXT)?

2001-06-27 Thread Julia Kuznetsov

I need to load couple xml files into memory and store them in ServletContext
when my application starts. I created a servlet to do that, but I can't
figure out how to make this servlet run automatically whem the app starts.
Is there smthg in server.xml that I can define to run this servlet?

Please help!

Julia Kuznetsov




Re: How to specify a startup servlet for an application (CONTEXT)?

2001-06-27 Thread Milt Epstein

On Wed, 27 Jun 2001, Julia Kuznetsov wrote:

 I need to load couple xml files into memory and store them in
 ServletContext when my application starts. I created a servlet to do
 that, but I can't figure out how to make this servlet run
 automatically whem the app starts.  Is there smthg in server.xml
 that I can define to run this servlet?

If I understand you right, you can put a load-on-startup tag in the
servlet definition tag in the context's web.xml file to take care of
this.

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]




Re: How to specify a startup servlet for an application (CONTEXT)?

2001-06-27 Thread evan . light


 If you want a servlet to init as part of your web app then you should
define it in your web app's WEB-INF/web.xml file with the following syntax:

web-app
 servlet
  servlet-nameput your servlet's name here/servlet-name
  servlet-classservlet.class.name.here/servlet-class
  init-param

param-namenameOfParamMappingToMutatorOnServlet/param-name
   param-valueput the value of the parameter
here/param-value
  /init-param
 /servlet

etc., ...

I believe that this will result in the execution of the servlet's init()
method.  Incidentally, mutator is synonymous for setter (e.g., setFoo(
String val)) if that's unclear.  You can also have any number of init-param
elements.

Evan

---
To design, to implement, to maintain, and not to kluge.


   
 
Julia Kuznetsov  
 
julia_kuznetsov@modusTo: 
[EMAIL PROTECTED]  
media.comcc:  
 
  Subject: How to specify a 
startup servlet for an application  
06/27/01 01:34 PM (CONTEXT)?   
 
Please respond to  
 
tomcat-user
 
   
 
   
 




I need to load couple xml files into memory and store them in
ServletContext
when my application starts. I created a servlet to do that, but I can't
figure out how to make this servlet run automatically whem the app starts.
Is there smthg in server.xml that I can define to run this servlet?

Please help!

Julia Kuznetsov