File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes load on start up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "load on start up" Watch "load on start up" New topic

load on start up

ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
what is mean by

<load on start up>2</load on start up>

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
That indicates that this servlet should be loaded (i.e., instantiated and its init method called) at the startup of the web app. Normally a servlet is not instantiated until it is first called. But if the overhead of the instantiation is substantial, that would delay its reponse to the first request. So load-on-startup allows you to indicate that it should be loaded right when the web app is started.

The "2" indicates that this particular servlet should be the second one to load - there is probably another servlet with a load-on-startup with a "1"; that is loaded first, and then so on in ascending order.
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

Adding to Ulf's reply.

Example of this kind of scenario is:

Struts ActionServlet. This needs to loaded first in an application(if application uses struts) because it takes some time to read configuration(struts-config.xml) file(s) and load it into memory.

Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />
Neerav Narielwala
Ranch Hand

Joined: Dec 08, 2006
Posts: 106
load−on−startup element that tells the JSP/servlet container
that we want this servlet to be preloaded when the Web application starts. You must pre−load the ActionServlet, or your Struts Views will not load all of their necessary resources.

<a href="" target="_blank" rel="nofollow">Java Tutorials</a> | <a href="" target="_blank" rel="nofollow">Java Weblog</a> | <a href="" target="_blank" rel="nofollow">Computing Articles</a>
I agree. Here's the link:
subject: load on start up
It's not a secret anymore!