• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load-on-startup

 
Thambi Rajah
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following question is from Eduardo Cobian's SCWCD Test (Mock exam)
Question 54)
*************************************************
Which statements are correct about load-on-startup elements
A) It must be an integer
B) It can be negative
C) If it is 0 (zero) it will be loaded at deployment time
D) Serveral servlets can have the same value for this element

The answer on Mock exam says: all (A),(B),(C) and (D) are correct.
*********************************************
Would somebody explain
(1) what does a negative number mean with load-on-startup element
(2) what does a zero value mean with load-on-startup element
(3) If several servlets have the same value for load-on-startup element, what order will
these servlets be loaded?
Thanks in advance,
Thambi
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the 2.3 specs:

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic