Community
Participate
Working Groups
Build Identifier: 8.1.0.RC2 The servlet specification says about the <servlet> element: -- The jsp-file element contains the full path to a JSP file within the web application beginning with a “/”. If a jsp-file is specified and the load-on-startup element is present, then the JSP should be precompiled and loaded. -- So having this in the web.xml: -- <servlet> <servlet-name>index</servlet-name> <jsp-file>/index.jsp</jsp-file> <load-on-startup>0</load-on-startup> </servlet> -- should precompile the jsp on applicaiton startup. Currently, jetty does not generate the compiled servlets inside the work directory on startup, only after accessing the page. I checked with Tomcat 7.0.23 for reference and the servlets are generated on startup. Thank you very much in advance, Jetty is great! Reproducible: Always Steps to Reproduce: 1. Deploy webapp with jsp-file and load-on-startup to the /webapp directory. 2. Look in work directory.
Created attachment 208892 [details] Simple war to demonstrate missing load-on-startup behaviour. Very simple webapp with some jsps to demonstrate the issue of missing <load-on-startup> behaviour with <jsp-file>s.
Thomas, You're absolutely correct about this, but I had a look at our code and it seems that its been missing from jetty for forever! Also, looking at the jsp code - and we use the jasper impl from Glassfish - there doesn't seem to be any support code in there to do this either. The Tomcat version of jasper seems to have been modified to support it. I think the best that I can do is to raise a bug over on Glassfish jsp project for them to add support. Jan
Tracked at JSP project here: http://java.net/jira/browse/JSP-23
Jan, Thank you very much for your effort and fast response, it's very much appreciated. The bug/feature is not that critical to me, just something I noticed. I guess passing it on to the glassfish guys resolves it for now. Thomas
Just documenting the results of some investigations so that it is not forgotten: + jetty 9.2.0.M0 switched to using apache jasper instead of glassfish jasper + that didn't resolve this problem as the container needs to take some steps to get the jsp container to pre-compile servlets that are <jsp-file>s: + tomcat does this: change the class of the servlet definition for the servlet to be the JspServlet, copy in all the init-params from the main JspServlet instance, and add in the value of the <jsp-file> as an init-param named "jspFile". When the JspServlet is started (because of the <load-on-startup>) it checks for this init-param and calls the compiler on it.
Fixed for 9.2.0.M1 if you use the apache-jsp module (new in 9.2). Jan