This week's giveaway is in the Java/Jakarta EE forum. We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line! See you should use the deployment descriptor (web.xml file) of your web application. Simply use the tag <load-on-startup>1</load-on-startup> under the <servlet> element. For a jsp page, it looks like this: <servlet> <servlet-name>MyJspPage</servlet-name> <jsp-file>/jsp/myJspPage.jsp</jsp-file> <load-on-startup>1</load-on-startup> </servlet> You should put the load-on-startup element in every servlet element where the body content of the tag is the order that the servlet should be translated/compiled.
Hmmm, seems that the web.xml route would be completely unweildly for anything but a rather trivial web application. Most of mine tend to have in the hundreds of JSP pages. I had started writing a 'web monkey' servlet to try to hunt down and hit every JSP, but I never really finished it. Also, most of the JSPs expect a controller to forward to them, so a direct hit may cause them to compile, but tends to generate a bunch of errors that I'd rather not have clogging the log files. The Ant script is a great idea, but there's still the errors-in-the-log problem. Anybody got a wifty idea for that one? bear [ September 26, 2003: Message edited by: Bear Bibeault ]
Thanks for the suggestions. Yeah, the load-on-startup solution is really not practical in my case, since I have about 1,000 JSPs in this web-app. Thanks, tho for the link to the script that precompiles JSPs. I will check it out. Hopefully it can do the trick. Thanks!
but i m using tomcat 8 and want to pre-compiled all jsp files at the time war file build.]
I created war file and upload to tomcat/webapps folder but when open any page at that time jsp file will compile (created *.java and *.class file).
But i want to do When War file Compile at tomcat startup at that time want to compile all jsp files.
If anybody have solution please tell me. i tried lots of method but still did not find any way.