load-on-startup element in web.xml

This tips explains the few points on how to use the load-on-startup element on the web.xml file. Whenever is starting, it is possible to tell the container to load a servlet on the startup. You can load any number of servlets on the startup. Normally this is done for any initialization purpose. Look into the following example:

also read:

<servlet>
<servlet-name>TestServlet</servlet-name>
 <servlet-class>TestServlet</servlet-class>
 <load-on-startup>1</load-on-startup>
</servlet>

The above example tells the container that the servlet will be loaded at first.The <load-on-startup> sub-element indicates the order in which each servlet should be loaded. Lower positive values are loaded first. If the value is negative or unspecified, then the container can load the servlet at anytime during startup.

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Trackbacks

  1. […] Add entries in web.xml for Filter class and the Cryto tag which we defined in Step 1.Also create a .tld file refering to […]

Speak Your Mind

*

Close
Please support the site
By clicking any of these buttons you help our site to get better