This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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
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.
Joined: Dec 19, 2001
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.
Joined: Nov 19, 2000
I have never used Tomcat. May be somebody else could help?