aspose file tools
The moose likes Servlets and the fly likes load on start-up Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply 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: 56153
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Thanks Bear. Ben and you helped me to understand this funda
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: load on start-up
 
Similar Threads
How to avoid directory listing?
Web application
Regarding the init() methods
what's the corresponding method for init-param?
Turning off directory browsing