> I am using jboss with tomcat. I want to precompiled my JSP pages, how
> will I do that.

The Jetty FAQ indeed has a very good description of how this is done. I
was able to follow those directions and get my JSPs precompiled for use
under JBoss using ANT to do the dirty work.     

<target name="do-precompile-jsp" unless="precompile-jsp.notRequired"> 
  <!-- PRECOMPILE the .jsp pages -->
  <echo message="Generating JSP code..."/>
       <java classname="org.apache.jasper.JspC" fork="true">
            <classpath>
             <pathelement
                    
location="${jboss.dir}/server/default/deploy/jbossweb.sar/org.apache.jasper.jar"/>
             <pathelement
                    location="${jboss.dir}/server/default/lib/javax.servlet.jar"/>
             <pathelement location="${jboss.dir}/lib/crimson.jar"/>
             <pathelement location="${output.dir}"/>
            </classpath>
            <arg value="-d"/>
            <arg value="${jsp.precompile.dir}" />
            <arg value="-p"/>
            <arg value="${application.name}"/> 
            <arg value="-webinc"/> 
            <arg value="${gen.mappings}"/> 
            <arg value="-webapp"/> 
            <arg value="${webapp.dir}/frontend"/>
       </java> 
       
       <echo message="Precompiling JSPs..."/> 
       
       <javac srcdir="${jsp.precompile.dir}" 
           destdir="${jsp.precompile.output.dir}" 
           classpathref="jsp.precompile.path"
           debug="${javac.debug}"
           optimize="${javac.optimize}" 
           deprecation="${javax.deprecation}"/> 
           
       <echo message="Merging servlet definitions into web.xml"/> 
       <loadfile property="jsp.servlets.text" srcFile="${gen.mappings}"/>
       <copy file="${webapp.dir}/frontend/WEB-INF/web.xml" overwrite="true" 
           todir="${webapp.dependency.dir}/WEB-INF" filtering="true">
           <filterset begintoken="&lt;" endtoken="&gt;">
               <filter token="!-- JSP Servlet Insertion Point --"
                 value="${jsp.servlets.text}"/>
           </filterset> 
       </copy> 
</target>

I apologize for the dismal formatting of the above XML, your variable
declarations will vary. I also thing the filtering copy operation is
somewhat new to ANT, but is available in 1.5.1 and later. All you have
to do is add a line <!-- JSP Servlet Insertion Point --> to your
web.xml. The copy operation is meant to copy and filter your 'source'
web.xml into a place where it will be used to build your .war file.
The reason I used a comment was because I've got my ANT scripts setup
to allow me to turn off precompiliation if I want to.

Hope this helps.

-Neal


-------------------------------------------------------
This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
Time is running out!  Thinkgeek.com has the coolest gifts for
your favorite geek.   Let your fingers do the typing.   Visit Now.
T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to