Tomcat (jasper2) JspC precompile not catching Struts TLDs

J

javaguy

My web application (Tomcat 5.5, JDK 1.5) currently works OK.

My application web.xml has this clause:

<jsp-config>

<taglib>
<taglib-uri>/tags/halo</taglib-uri>
<taglib-location>/WEB-INF/halo.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-html-el</taglib-uri>

<taglib-location>/WEB-INF/struts-html-el.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-logic-el</taglib-uri>

<taglib-location>/WEB-INF/struts-logic-el.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-tiles-el</taglib-uri>

<taglib-location>/WEB-INF/struts-tiles-el.tld</taglib-location>
</taglib>

</jsp-config>

My web pages, with clauses with:

<%@ include file="trafficCopPopUp.jsp" %>
<%@ include file="cacheControl.jsp" %>

<%@ taglib uri="/tags/struts-html-el" prefix="h" %>
<%@ taglib uri="/tags/struts-logic-el" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

are precompiled by Tomcat into Java files like this:

private static java.util.List _jspx_dependants;

static {
_jspx_dependants = new java.util.ArrayList(4);
_jspx_dependants.add("/trafficCopPopUp.jsp");
_jspx_dependants.add("/cacheControl.jsp");
_jspx_dependants.add("/WEB-INF/struts-html-el.tld");
_jspx_dependants.add("/WEB-INF/struts-logic-el.tld");
}

This is OK.

Now suppose I try to precompile the JSP file using this build.xml:

<project name="WebStarJspc" default="all"
basedir="C:/deployed_webapps/portal">
<property file="C:/batch/build.properties"/>
<property file="${user.home}/build.properties"/>

<path id="classpath.base">
<pathelement location="${activation.dir}/${activation.jar}"/>
<pathelement location="${bfopdf.dir}/${bfopdf.jar}"/>
<pathelement location="${ifxjdbc.dir}/${ifxjdbc.jar}"/>
<pathelement location="${jsp-api.dir}/${jsp-api.jar}"/>
<pathelement location="${jstl.dir}/${jstl.jar}"/>
<pathelement location="${log4j.dir}/${log4j.jar}"/>
<pathelement location="${mail.dir}/${mail.jar}"/>
<pathelement location="${radius.dir}/${radius.jar}"/>
<pathelement location="${servlet-api.dir}/${servlet-api.jar}"/>
<pathelement location="${standard.dir}/${standard.jar}"/>
<pathelement location="${struts.dir}/${struts.jar}"/>
<pathelement location="${fileupload.dir}/${fileupload.jar}"/>
<pathelement location="${logging.dir}/${logging.jar}"/>
</path>

<target name="jspc">
<taskdef classname="org.apache.jasper.JspC" name="jasper2" >
<classpath id="jspc.classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${tomcat.home}/bin">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/server/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/common/lib">
<include name="*.jar"/>
</fileset>
<path refid="classpath.base"/>
</classpath>
</taskdef>

<jasper2 verbose="9"
validateXml="false"
uriroot="."
webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
outputDir="${deployed-web.dir}/WEB-INF/src2/" />

</target>

<target name="all" description="compile, stop Tomcat, deploy, start
Tomcat" depends="jspc" />

</project>

(Yes, I know that the results are put into some odd directory, and that
the generated JSP files aren't yet compiled into class files. This
sample build.xml file is only meant to illustrate my problem.)

The same JSP file is instead compiled as such:

private static java.util.List _jspx_dependants;

static {
_jspx_dependants = new java.util.ArrayList(2);
_jspx_dependants.add("/trafficCopPopUp.jsp");
_jspx_dependants.add("/cacheControl.jsp");
}

The Struts TLD files are not sought, or used. Error messages are not
emitted by the compile process. The source JSP files have the TLD
files in the correct location.

I don't see any documentation on forcing the TLD files to be recognized
by the compiler. So I'm not able to manually precompile my JSP files
because they are compiled wrong.

Any clues out there?
Thanks,
Jerome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top