aspose file tools*
The moose likes Servlets and the fly likes sinificance of  value of tag  <load-on-startup> in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "sinificance of  value of tag  <load-on-startup> in web.xml" Watch "sinificance of  value of tag  <load-on-startup> in web.xml" New topic
Author

sinificance of value of tag <load-on-startup> in web.xml

Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35
Hi,

Please explain the significance of the value we will give for the tag <load-on-startup> in web.xml file.

Ex :

In the above tag what the value 5 indicates ???
What if I give 3 instead of 5.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
It means that if you have another servlet with a value for <load-on-startup> that is less than this one, it will get loaded before this servlet.

A positive value means that it WILL get loaded upon server startup (I think 0 too, not 100% sure though)


JDBCSupport - An easy to use, light-weight JDBC framework -
Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35
Sebastian Janisch wrote:It means that if you have another servlet with a value for <load-on-startup> that is less than this one, it will get loaded before this servlet.

A positive value means that it WILL get loaded upon server startup (I think 0 too, not 100% sure though)



hi,
you mean to say it is the priority value for creation of that servlet object???
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
If you omit this tag, the container might load the servlet at any arbitrary point during runtime. It might be during startup, but could also be upon first client request (which is bad if there are heavy resources to be loaded upon creation). If you pass any positive value to it, it will get loaded upon startup. The figure simple determines the order in correlation to the other servlets.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

The Servlet Specification describes this in detail.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

you can find the exact explanation at the below link

http://www.javabeat.net/tips/166-load-on-startup-element-in-webxml.html


Regards
Salil Verma
jazy smith
Ranch Hand

Joined: Nov 18, 2009
Posts: 101
Sebastian Janisch wrote:If you omit this tag, the container might load the servlet at any arbitrary point during runtime.


hi,

can you please explain what is the difference between loading of servlet and actuall display of the servlet on the monitor screen. I mean when you say the servlet is loaded, what does that mean actually ?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

It means that the servlet class definition is loaded, an instance of the servlet is created, and the init() method called.
jazy smith
Ranch Hand

Joined: Nov 18, 2009
Posts: 101
thanks bear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sinificance of value of tag <load-on-startup> in web.xml