wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes servlet load-on-startup with value 0? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "servlet load-on-startup with value 0?" Watch "servlet load-on-startup with value 0?" New topic

servlet load-on-startup with value 0?

zhong chen

Joined: Oct 12, 2009
Posts: 24
in MZ notes, it says:

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.

Any non-negative value for <load-on-startup> tells the Container to initialize the servlet when the app is deployed (or any time the server restarts).

negative or 0 : no preloading; load at first request;
1 or more : servlet loaded at startup.

FE notes is different than the other two versions. Which one is correct?
If 0 means pre-load the servlet, will it take precedence than value 1?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41079
Section 13.3 of the Servlet 2.5 Specification has the definitive word on this.

Ping & DNS - my free Android networking tools app
zhong chen

Joined: Oct 12, 2009
Posts: 24
Thanks Ulf. I got it now. For others that have the same doubt, here is what's in spec:

Don't get me started about those stupid light bulbs.
subject: servlet load-on-startup with value 0?
Similar Threads
What is the use of this servlet?
what does <load-on-startup> do in web.xml ?
question on servlet
Static Initialization Block