tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krause Karin <>
Subject RE: JSP Compilation - saving compiled JSPs to disk howto?
Date Tue, 09 Sep 2003 10:54:42 GMT
I use the following ant target to compile / and generate jsp definitions in
the web.xml file
<!-- ==================== compile.jsp =================================== -->
  The "compile.jsp" target generates from jsp files by means of Jasper2 java source files
  into the project source directory. It also generates a web_jsp.xml file that contains the
  related entries for the web.xml file.

	<target name="compile.jsp" description="compiles jsp files to java sources">
		 <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
      	 <classpath id="jspc.classpath">
         <pathelement location="${java.home}/../lib/tools.jar"/>
         <fileset dir="${catalina.home}/server/lib">
            <include name="*.jar"/>
         <fileset dir="${catalina.home}/common/lib">
            <include name="*.jar"/>
             outputDir="${basedir}/src" />


This ant target generates java sources into a directory src. Afterwards those java classes
are compiled
using the normal way all my project classes are compiled (I use Eclipse as IDE). Then I supply
them inside
my WAR file. Also you will need the generated webXmlFragement (called web_jsp.xml). The compiled
jsp's are
indeed just another servlets. Here is a snippet how the web_jsp.xml fragment may look for
a jsp called footer.jsp

In order to make my "normal" web.xml file more readable I just included the web_jsp.xml as
so-called external
entity in my web.xml file. Here is an example for that.
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' ''
	<!ENTITY web_jsp SYSTEM "web_jsp.xml"> 

		<description>Simple Test Servlet to test the Jackpot Custom tags</description>
		Here we import the webinc.xml files that contains servlets for the
		Here comes my normal servlet mapping


So when accessing my jsp page "jsp/footer.jsp" than the servlet jsp.footer_jsp is invoked
and no compilation
takes place.


-----Original Message-----
From: Duncan Frostick []
Sent: Dienstag, 9. September 2003 12:29
To: Tomcat Users List
Subject: JSP Compilation - saving compiled JSPs to disk howto?

(If this is received twice I apologise)

Hi all,

I'm hoping this is a simple question that only needs one config change, 
but I don't know. I need to configure tomcat so that when a JSP is 
compiled upon first request, the actual compiled file is saved to disk 
permanently and used by tomcat from the disk rather than stored and run 
only from memory. The reason this is needed is so that after a tomcat 
restart (which is needed quite regularly), all the JSPs don't need to be 
recompiled, which takes a long time on our large application. Of course, 
if the JSP source has changed, then it would need to recompile, but 
otherwise I'd like it to use a disk copy of the compiled JSP, saving the 
server recompiling upon a restart, thus saving our users a long time of 
waiting for the server to become responsive again.

Any help much appreciated,

Duncan Frostick

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message