• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need an answer...

 
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which statements are correct about load-on-startup elements
1) It must be an integer
2) It can be negative
3) If it is 0 (zero) it will be loaded at deployment time
4) Serveral servlets can have the same value for this element
I think the correct answer is..1,3
thanks
Trupti
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All options are corrrect.
* The container may choose the order of loading of servlets with the same load-on-startup value. *If the value is 0 or +ive then the container must load & initilaize the servlets as app depolyed in the ascending order of load-on-startup value.
* Or if it is -ive or this element is not present, then container is free to load servlets whenever it choose.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, note that just the mere presence of <load-on-startup> </load-on-startup> element without a value will cause the servlet to be loaded on startup.
In my work place, there was a servlet which was configured with a <load-on-startup> value of 1 initially. At one point of time we did not want that servlet to be loaded on startup. What the deployer did was, he just erased the value alone (thinking that it will not be loaded on startup).
Latter we found that the servlet was still loading on JRun restart. This is how we learned that if you do not want a servlet to be loaded on start up, just delete the whole segment of <load-on-startup> n </load-on-startup>.
Regards,
Maha Anna
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please take a look at the spec about <load-on-startup>.
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.
Back to the question, all options are correct.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSP spec does not specifiy what the container will do if the <load-on-startup> element is present, but without any contents. According to Maha, it seems it treats like a 0.
-Bernd
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic