• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load-on-startup element valid values

 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are the valid values of this element ? What does a negative value or zero mean ? Does it have to be one to indicate that the servlet should be loaded at the time of container start up ?
 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also came across a question in one of the mock exams that <load-on-startup> should appear before <init-param> element. However the book has an example that has the order reverse. which is correct ?
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rasika Chitnis:
<load-on-startup> should appear before <init-param>

Accroding to the DTD (below) load-on-startup should be placed after init-param.
<!ELEMENT servlet (icon?, servlet-name, display-name?, description?, (servlet-class|jsp-file), init-param*, load-on-startup?, runas?, security-role-ref*)>
And here is its description from spec.
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