views:

37

answers:

2

Obviously, load_on_startup value of 0 means don't, and 1 means do. But what does a value of 2 mean?

EDIT: Obviously, I shouldn't assume things before I check them. A value of 0 still means load on startup. Thanks stacker.

The servlet specification is surprisingly hard to reach.

(Here's where I saw 2 as a possible value).

A: 

It defines the order in which the container loads the servlet. The servlet is not loaded until a request tries to access it.

The container starts the servlet in ascending order of the load on defined startup value (1 before 2, 2 before 5 and so on.)

Kartik
"The servlet is not loaded until a request tries to access it." - I'm not sure what you meant by that, but it sounds like the exact opposite of `load_on_startup`
itsadok
+2  A: 

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.

stacker
So setting the value to 0 still causes the servlet to load on startup?
itsadok
yes, as per the servlet spec, "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 thatservlets marked with lower integers are loadedbefore servlets marked with higher integers.". So 0 will be loaded first.
JoseK