my dog learned polymorphism*
The moose likes JSP and the fly likes JSP load on startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP load on startup" Watch "JSP load on startup" New topic
Author

JSP load on startup

Jason Brawner
Ranch Hand

Joined: Dec 19, 2001
Posts: 66
I used the following xml in my deployment descriptor expecting Tomcat4 to
generate a servlet from my jsp within the work directory on startup.
<servlet>
<servlet-name>Home</servlet-name>
<jsp-file>/home.jsp</jsp-file>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/home.jsp</url-pattern>
</servlet-mapping>
It appears to have done nothing. The servlet isn't generated until I
request home.jsp for the first time. Shouldn't
it have compiled, loaded and initialized my jsp when Tomcat started?


Jason E. Brawner<br />Sun Certified Java Programmer<br />Sun Certified Web Component Developer
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I think that the load-on-startup tag is to pre-compile a servlet. In WebLogic, we use context-param tag in the web.xml file to precompile a JSP.
Jason Brawner
Ranch Hand

Joined: Dec 19, 2001
Posts: 66
Yes, the load-on-startup tag does load a servlet. I just assumed it would work for a JSP as well. I know Jasper, an Apache product, will compile the JSP but I would also like it loaded when tomcat starts.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I have never used Tomcat. May be somebody else could help?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP load on startup