What does the servlet value signify

Resin 3.0 documents this behavior:

load-on-startup can specify an (optional) integer value. If the value is 0 or greater,
it indicates an order for servlets to be loaded, servlets with higher numbers get
loaded after servlets with lower numbers.

The JSP 3.1 spec (JSR 340) says this on page 14-160:

The element load-on-startup indicates that this servlet should be loaded (instantiated
and have its
init() called) on the startup of the Web application. The element content of this
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-startup value.

You probably want to check not only the JSR, but also the documentation for your web container. There may be differences

Leave a Comment