You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Eric Chow <ec...@macaucabletv.com> on 2003/01/20 03:47:11 UTC

Jspc problems ?

Hi,


I tried to use Jasper in Ant as a Ant Task to precompile JSP files.

I defined the taskdef in Ant as mentioned in the JavaDoc as following:

<target name="jspc">
  <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
   <classpath refid="run.classpath"/>
  </taskdef>
    
  <jasper2 verbose="0" 
     package="eric.test.jsp"
     uriroot="${basedir}/myserv"
     webXmlFragment="${basedir}/jsp/web.xml" 
     outputDir="${basedir}/jsp" />
  
  <taskdef classname="MergeWebXML" name="mergeweb">
   <classpath refid="run.classpath"/>
  </taskdef>
  
  <mergeweb web="${basedir}/myserv/WEB-INF/web.xml" append="${basedir}/jsp/web.xml"/>
  
  <delete file="${basedir}/myserv/WEB-INF/web.xml"/>
  <copy file="${basedir}/myserv/WEB-INF/web.xml-out" tofile="${basedir}/myserv/WEB-INF/web.xml"/>
  <!--
  <delete file="${basedir}/myserv/WEB-INF/web.xml-out"/>
  -->
  <mkdir dir="${basedir}/jsp/classes"/>
  
  <javac srcdir="${basedir}/jsp" 
     destdir="${basedir}/jsp/classes"
     debug="on"
     deprecation="on"
     optimize="off"
     fork="yes">
   <classpath refid="run.classpath"/>
  </javac>
  
  <jar jarfile="jsps.jar" basedir="${basedir}/jsp/classes"/>
  
  <copy todir="${basedir}/myserv/WEB-INF/lib">
   <fileset dir="${basedir}">
    <include name="jsps.jar"/>
   </fileset>
  </copy>
 </target>

The JSP-to-Java is successful but some error when compile the Java files if in the following situation:

The following is my web application directory structures:

$WEB_ROOT/WEB-INF/web.xml
$WEB_ROOT/index.jsp
$WEB_ROOT/admin/index.jsp


As you can see there are two index.jsp files but in different folder of my WEB_APP. But the Jasper only generate a UNIQUE package "eric.test.jsp".
It will not generate package for the "admin" folder, for example, the package of "index.jsp" in the "admin" folder should be "eric.test.jsp.admin", but it just generate the same package of all Java files from JSP files.

Therefore, when I compile the Java files, it just raised error "Duplicate class definition" or something like that.

Is there any change in the newer version of coming version?

I am using Tomcat 4.1.8.


Bets regards,
Eric






==========================
If you know what you are doing, 
it is not called RESEARCH!
==========================