File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes <load-on-startup> Tag in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "<load-on-startup> Tag in web.xml" Watch "<load-on-startup> Tag in web.xml" New topic

<load-on-startup> Tag in web.xml

Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Hi All ,

Can anyone suggest what will happen if i am giving value 0 or negative or empty .What will be the loading sequence.

Have a great day.....

Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

From the XML Schema description:
The load-on-startup element indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the web application. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same load-on-start-up value.

[My Blog]
All roads lead to JavaRanch
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Thanks Christopher ....Have a great day
I agree. Here's the link:
subject: <load-on-startup> Tag in web.xml