Is there a common way (not servlet-container dependant) to precompile a jsp file without waiting for the first hit?

Alessandro A. Garbagnati

Yes, there is a common solution that it's defined in the JSP specification and it has to be implemented by any container that claim to be compliant.
JSP 1.1 Specification paragraph 3.4.2 states:

A request to a JSP page that has a request parameter with name "jsp_precompile" is a precompilation request. The "jsp_precompile" parameter may have no value, or may have values "true" or "false". In all cases, the request should not be delivered to the JSP page.
The intention of the precompilation request is that of a hint to the JSP container to precompile the JSP page into its JSP page implementation class. The hint is conveyed by given the parameter the value "true" or no value, but note that the request can be just ignored in all cases.
Moved to paragraph 8.4.2 in JSP 1.2 PDF 2 Specification

So, to precompile 'myPage.jsp' it's enough to use 'myPage.jsp?jsp_precompile'.
This feature is extremely interesting even for verifying the code inside a page that requires parameters, or that contains code like sql insert or delete queries, etc.


In addition, many container have specific solution, some of them already covered by FAQs:
Tomcat with a comment regarding Oracle or JRun.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact