Hi, I'm having problems doing JSP pre-compilation using Tomcat's JSP pre-compilation libraries and Ant. The problem is demonstrated by the following:
test.jsp: <% String myVar = "Hello"; %> <%@ include file="test2.jsp" %> Some more text test2.jsp <H1>Goodbye</H1> <%= myVar + "World" %> Testing build.xml <project default="compile-jsps"> <target name="compile-jsps"> <mkdir dir="${basedir}/build/web-test" description="creating classes directory"/> <taskdef classname="org.apache.jasper.JspC" name="jasper2"/> <jasper2 validateXml="false" uriroot="${basedir}/web-test" outputDir="${basedir}/build/web-test" compile="true"/> </target> </project> test.jsp loads correctly when accessed from Tomcat, however, when I use Ant with the build.xml above and Tomcat's JSP compiler libraries I get: D:\dev\myproject\build\web-test\org\apache\jsp\test2_jsp.java:43: cannot find symbol symbol : variable myVar location: class org.apache.jsp.test2_jsp out.print( myVar + "World" ); ^ 1 error I have tested this using both Tomcat 5.5.15 and Tomcat 5.5.20. When JspC completes there are 2 Java source files, test2_jsp.java which ties up with test2.jsp's content (making reference to myVar but not declaring it) and test_jsp.java which contains the combined content of test.jsp and test2.jsp. I've flagged that JspC should compile the generated source files with the compile="true" attribute, I discovered this through looking at the Javadocs. My gut feel is that JspC should remove any Java source files that represent JSPs that cannot be run standalone, e.g. test2.jsp, as its final step before completing thus leaving only Java source files that can be compiled. The main point of reference for doing JSP pre-compilation seems to be http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html but it is very sparse on this subject i.e. here's a sample build.xml, it doesn't even indicate there is a compile option. Tomcat should document what attributes the JSPc task supports, just like any other Ant task. Thanks, Martin. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]