users@glassfish.java.net

Re: Glassfish clean always compiled JSP

From: <glassfish_at_javadesktop.org>
Date: Sun, 14 Mar 2010 20:46:06 PDT

I've managed to get pre-compiled JSPs to work and when I deployed the WAR, I can even delete the JSPs and all works well. After a reboot, the compiled JSP's are still good.

To do this, I first enabled the Test compile of JSPs, see:
http://forums.java.net/jive/thread.jspa?threadID=21931

I modified my build.xml project differently, by adding this to the bottom to override a target and add another:

   <target name="addCompiledJSPs">
        <echo message="Placing compiled JSPs into ${build.classes.dir}"/>

        <copy todir="${build.classes.dir}">
          <fileset dir="${build.generated.dir}/classes"/>
        </copy>

        </target>
    <target depends="init,compile,compile-jsps,-pre-dist,addCompiledJSPs,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist" />


I then had to modify my web.xml file to reference the compiled JSPs. Here is an example of one of them (note that you have to add each of these tags for each JSP):

    <servlet>
        <servlet-name>index.jsp</servlet-name>
        <servlet-class>org.apache.jsp.index_jsp</servlet-class>
    </servlet>


    <servlet-mapping>
        <servlet-name>index.jsp</servlet-name>
        <url-pattern>/index.jsp</url-pattern>
    </servlet-mapping>
[Message sent by forum member 'behrens' (dotjava_at_netzero.net)]

http://forums.java.net/jive/thread.jspa?messageID=391851