Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tomcat5 and precompiling JSPs with Ant

843836Sep 14 2004 — edited Feb 25 2008
Hi I'm trying to precompile my JSPs in ANT and I'm using Tomcat5. Below is my taskdef:
<target name="jsp" depends="build">
    <!--
         The Ant JSPC task doesn't work with Tomcat 5.0
         so in the meantime we need to define our own task.
      -->
    <taskdef name="jspc50" classname="org.apache.jasper.JspC">
        <classpath id="jspc50.classpath">
            <fileset dir="${tomcat.home}">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </taskdef>

    <jspc50 outputDir="${classes}"
            uriroot="${src}"
            package="jsp"
            validateXml="false">
        <include name="**/*.jsp" />
        <exclude name="**/includes/**/*.jsp" />
    </jspc50>

    <javac srcdir="${classes}"
           destdir="${classes}"
           debug="true"
           optimize="false"
           includes="**/*.java"
           source="1.4">
    </javac>
</target>
Now, this actually works but if I use an absolute include directive in my JSPs like:
<%@ include file="/includes/header.jsp" %>
Then I get the "/include/header.jsp" not found. However, if I change to
<jsp:include page="/includes/header.jsp" />
It works fine. Now, I want to use an absolute path and I also want to use the include directive. Has anybody seen this problem and know a solution?

Thanks,
Mike

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2008
Added on Sep 14 2004
8 comments
696 views