tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <>
Subject RE: precompiling JSP
Date Fri, 24 Aug 2001 11:03:30 GMT

	You could use JspC when you deploy.  This way your users would never
have to wait for a compile.  The command that I use is:

	%TOMCAT_HOME%/bin/jspc -d <<Path to output your Java Source>>
-webxml <<Path to output the web.xml file>> -webapp << Path to the root
the web.xml files>>
	Now run javac on the directory you output the source to

	I did find it necessary to add the jasper.jar and tomcat_util.jar
file to the classpath for this command under Tomcat 3.3.

	I generally try and use Ant to build my WAR files and the general
steps that I use are:
	1.  Fetch source from repository (SourceSafe, CVS, etc), this will
get all the JSPs in a temp source directory that has a WEB-INF/source
directory to hold the .java source

	2.  Compile JSPs using the following:
    <!-- Use JspC to compile the JSPs into .java -->
    <java classname="org.apache.jasper.JspC">
      <arg value="-d" />
      <arg value="${src}/WEB-INF/source" />
      <arg value="-webxml" />
      <arg value="${src}/WEB-INF/source/auto-web.xml" />
      <arg value="-webapp" />
      <arg value="${src}" />
        <pathelement location="${tomcatRoot}/lib/tomcat.jar" />
location="${tomcatRoot}/lib/common/servlet.jar" />
        <pathelement location="${tomcatRoot}/lib/container/jasper.jar" />
location="${tomcatRoot}/lib/container/tomcat_util.jar" />

	3.  Use javac to compile WEB-INF/source into WEB-INF/classes
	4.  Remove the sources (*.jsp, *.java) from the src directory
	5.  (Manually) merge the web.xml with the auto-web.xml from jspC
	5.  Using JAR command, create a WAR file
	6.  FTP the WAR to a temp place on the test and/or production server
	7.  (Manually) Run a script that stops Tomcat, removes the expanded
webapp, copies the new WAR file, and starts Tomcat again.

	Depending upon how large the source tree is and the speed of the
machine in question, I have found that I can run the script faster than I
can type the respective commands by hand.


> -----Original Message-----
> From: Atanas Michev []
> Sent: Friday, August 24, 2001 5:17 AM
> To:
> Subject: precompiling JSP
> Hi,
> I would appreciate if someone can tell me how to:
> - precompile a JSP file step by step
> - precompile more than one JSP file in one Servlet in order 
> to make faster 
> their approaching when calling them for the first time.
> Many thanks in advance
> Atanas
> _________________________________________________________________
> Get your FREE download of MSN Explorer at 

View raw message