aspose file tools*
The moose likes Servlets and the fly likes load on start-up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "load on start-up" Watch "load on start-up" New topic
Author

load on start-up

Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Can I use more than one <load-on-startup> tag in a web.xml?

Ofcourse for diff servelts mentioned in web.xml

Example:

<servlet>
<servlet-name>Log4JInit</servlet-name>
<servlet-class>com.me.pictures.logging.LogInitServlet</servlet-class>
<init-param>
<param-name>log4j-init-file</param-name>
<param-value>/WEB-INF/classes/resources/log4j.properties</param-alue>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>debug</servlet-name>
<servlet-class>com.me.pictures.debug.DebugServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>


Srini
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Yes, but you wouldn't want them both to be number 1.
That number determines the order in which the servlets load.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Thanks Ben....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61424
    
  67

Although you can legally repeat the same number if the order of load doesn't matter. For example if A and B need to load before C, but the order of A and B is moot, both A and B can be 1, and C can be 2.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Thanks Bear. Ben and you helped me to understand this funda
 
wood burning stoves
 
subject: load on start-up