Here is the solution that worked for me: http://cvs.apache.org/~fhanik/precompile.html
Antony Paul wrote:
I use the following Ant build file to precompile all jsps to work dir. I prepared this based on another post in this list. All the jsps are converted to java and then to class files.
<project name="myapp" default="all" basedir="E:\Tomcat4.1\work\Standalone\localhost\myapp"> <!--Simple build file to compile all jsp files to java and javac to the work directory of tomcat installation --> <property name="tomcat.home" value="E:\Tomcat4.1"/> <property name="webapp.path" value="E:\Projects\myapp"/> <!-- web application docBase in server.xml -->
<target name="jspc"> <taskdef classname="org.apache.jasper.JspC" name="jasper2" > <classpath id="jspc.classpath"> <pathelement location="${java.home}/../lib/tools.jar"/> <fileset dir="${tomcat.home}/server/lib"> <include name="*.jar"/> </fileset> <fileset dir="${tomcat.home}/common/lib"> <include name="*.jar"/> </fileset> </classpath> </taskdef>
<jasper2 validateXml="false" uriroot="${webapp.path}" webXmlFragment="${basedir}/generated_web.xml" outputDir="${basedir}" />
</target>
<target name="javac" depends="jspc">
<javac srcdir="${basedir}" destdir="${basedir}" optimize="off" debug="on" failonerror="false" excludes="**/*.smap"> <classpath> <pathelement location="${webapp.path}/WEB-INF/classes"/> <fileset dir="${webapp.path}/WEB-INF/lib"> <include name="*.jar"/> </fileset> <pathelement location="${tomcat.home}/common/classes"/> <fileset dir="${tomcat.home}/common/lib"> <include name="*.jar"/> </fileset> <pathelement location="${tomcat.home}/shared/classes"/> <fileset dir="${tomcat.home}/shared/lib"> <include name="*.jar"/> </fileset> </classpath> <include name="**" /> <exclude name="tags/**" /> </javac>
</target>
<target name="all" depends="jspc,javac"> </target>
</project>
Rgds Antony Paul.
----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, November 28, 2003 12:25 PM Subject: Re: Preload JSP when it's startup
Can you please tell me exact instruction? Script?? store it in where? how?
Deepak Parbhoo <[EMAIL PROTECTED]> 11/28/2003 01:12 PM Please respond to "Tomcat Users List"
To: Tomcat Users List <[EMAIL PROTECTED]> cc: Subject: Re: Preload JSP when it's startup
Write a script that calls the jsp's with '?jsp_precompile=true' as a parameter. So if the page is called start.jsp you will make a request to: "http://<server>:<port>/start.jsp?jsp_precompile=true".
[EMAIL PROTECTED] wrote:
As we know, first time when JSP is called, it's complied into Servlet and the next time you call the same jsp, the respond time will be faster.
Thus, anywar for Tomcat to set to preload the JSP page when it's starting up the server?
Thanks.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
