You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by John Trollinger <ja...@trollingers.com> on 2002/08/23 20:37:28 UTC

[PROPOSAL] - jasper2 JspC --servlet option

This option will compile the jsp pages with a package structure so that
they can be deployed as servlets rather than jsp pages. (it can also be
used with the -p option that will give it a base package name) 

/index.jsp --> <base package name>.index_jsp
/subdir/index.jsp --> <base package name>.subdir.index_jsp 

Let me know if anyone likes this, if so I will go ahead and do the impl.

John Trollinger


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [PROPOSAL] - jasper2 JspC --servlet option

Posted by Steve Downey <st...@netfolio.com>.
Is there a reason you're including tools.jar in the classpath? Last I
checked, which was a while ago, jspc didn't need it, and the compilation of
the generated servlets really should not need it.


> -----Original Message-----
> From: costinm@covalent.net [mailto:costinm@covalent.net]
> Sent: Friday, August 23, 2002 3:03 PM
> To: Tomcat Developers List
> Subject: Re: [PROPOSAL] - jasper2 JspC --servlet option
>
>
> Ok, I'm confused - I thought that already works.
>
> I'm actually using this feature - jspc generates servlets and
> web.xml fragments.
>
> Is there something missing ?
>
> What I use ( I already posted that ) is:
>
>   <target name="jspc" depends="..." >
>     <mkdir dir="${build.dir}/src/myPackage" />
>     <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
>       <classpath>
>         <pathelement location="${java.home}/../lib/tools.jar"/>
>         <fileset dir="${tomcat.home}/server/lib">
>           <include name="*.jar"/>
>         </fileset>
>         <fileset dir="${tomcat.home}/common/lib">
>           <include name="*.jar"/>
>         </fileset>
>         <pathelement location="${build.dir}/classes"/>
>         <path refid="myjars"/>
>       </classpath>
>     </taskdef>
>
>     <jasper2 verbose="0"
>              package="myPackage"
>              compile="true"
>              validateXml="false"
>              uriroot="${my.webapp.dir}"
>              webXmlFragment="${build.dir}/generated_web.xml"
>               outputDir="${build.dir}/src/myPackage" />
>
>     <loadfile property="generated_web.xml"
>               srcFile="${build.dir}/generated_web.xml"  />
>     <replace file="${my.webapp.dir}/WEB-INF/web.xml"
>              token="&lt;!--GENERATED_JSPS--&gt;"
>              value="${generated_web.xml}" />
>
>     <javac destdir="${build.dir}/classes"
>            optimize="off"
>            debug="on"
>            srcdir="${build.dir}/src" >
>       <classpath>
>         <pathelement location="${java.home}/../lib/tools.jar"/>
>         <fileset dir="${tomcat.home}/server/lib">
>           <include name="*.jar"/>
>         </fileset>
>         <fileset dir="${tomcat.home}/common/lib">
>           <include name="*.jar"/>
>         </fileset>
>         <pathelement location="${build.dir}/classes"/>
>         <path refid="myjars"/>
>       </classpath>
>       <include name="myPackage/**" />
>     </javac>
>
>     <jar jarfile="${my.webapp.dir}/WEB-INF/lib/my-jsp.jar" >
>       <fileset dir="${build.dir}/classes">
>         <include name="myPackage/**"/>
>       </fileset>
>     </jar>
>   </target>
>
> Costin
>
>
> On Fri, 23 Aug 2002, John Trollinger wrote:
>
> > This option will compile the jsp pages with a package structure so that
> > they can be deployed as servlets rather than jsp pages. (it can also be
> > used with the -p option that will give it a base package name)
> >
> > /index.jsp --> <base package name>.index_jsp
> > /subdir/index.jsp --> <base package name>.subdir.index_jsp
> >
> > Let me know if anyone likes this, if so I will go ahead and do the impl.
> >
> > John Trollinger
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PROPOSAL] - jasper2 JspC --servlet option

Posted by co...@covalent.net.
Ok, I'm confused - I thought that already works.

I'm actually using this feature - jspc generates servlets and 
web.xml fragments.

Is there something missing ? 

What I use ( I already posted that ) is:

  <target name="jspc" depends="..." >
    <mkdir dir="${build.dir}/src/myPackage" />
    <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
      <classpath>
        <pathelement location="${java.home}/../lib/tools.jar"/>
        <fileset dir="${tomcat.home}/server/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${tomcat.home}/common/lib">
          <include name="*.jar"/>
        </fileset>
        <pathelement location="${build.dir}/classes"/>
        <path refid="myjars"/>
      </classpath>
    </taskdef>
    
    <jasper2 verbose="0" 
             package="myPackage"
             compile="true"
             validateXml="false"
             uriroot="${my.webapp.dir}"
             webXmlFragment="${build.dir}/generated_web.xml" 
              outputDir="${build.dir}/src/myPackage" />
    
    <loadfile property="generated_web.xml" 
              srcFile="${build.dir}/generated_web.xml"  />
    <replace file="${my.webapp.dir}/WEB-INF/web.xml" 
             token="&lt;!--GENERATED_JSPS--&gt;" 
             value="${generated_web.xml}" />

    <javac destdir="${build.dir}/classes" 
           optimize="off"
           debug="on"
           srcdir="${build.dir}/src" >
      <classpath>
        <pathelement location="${java.home}/../lib/tools.jar"/>
        <fileset dir="${tomcat.home}/server/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${tomcat.home}/common/lib">
          <include name="*.jar"/>
        </fileset>
        <pathelement location="${build.dir}/classes"/>
        <path refid="myjars"/>
      </classpath>
      <include name="myPackage/**" /> 
    </javac>
    
    <jar jarfile="${my.webapp.dir}/WEB-INF/lib/my-jsp.jar" >
      <fileset dir="${build.dir}/classes">
        <include name="myPackage/**"/>
      </fileset>
    </jar>
  </target>

Costin


On Fri, 23 Aug 2002, John Trollinger wrote:

> This option will compile the jsp pages with a package structure so that
> they can be deployed as servlets rather than jsp pages. (it can also be
> used with the -p option that will give it a base package name) 
> 
> /index.jsp --> <base package name>.index_jsp
> /subdir/index.jsp --> <base package name>.subdir.index_jsp 
> 
> Let me know if anyone likes this, if so I will go ahead and do the impl.
> 
> John Trollinger
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>