You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Hofmann, Benjamin" <Be...@oneok.com> on 2004/07/16 18:30:01 UTC

Precompiling JSP How To

How do I set up my Tomcat 5 to precompile all of my JSP files?

 

Thanks,

Ben


Re: Precompiling JSP How To

Posted by QM <qm...@brandxdev.net>.
On Fri, Jul 16, 2004 at 11:30:01AM -0500, Hofmann, Benjamin wrote:
: How do I set up my Tomcat 5 to precompile all of my JSP files?

If you use Ant to build your app, you can follow the instructions in the
Tomcat docs.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Precompiling JSP How To

Posted by Andre Legendre <ha...@yahoo.com>.
Hi Tim

Thank you for your answer. It is Ok now.

Have nice time

Andre

Tim Funk wrote:

> In the jasper2 task, the uriroot="${build.dir}" is where the root of 
> the web app is located. So you build.xml can be one place, the webapp 
> root can be at another pllace, and the outputfiles from jspc (and 
> compiled classes) can each be their own subdirectories.
>
> -Tim
>
> Andre Legendre wrote:
>
>> Hi
>>
>> I tried to use this build.xml. It help me alot but I still have some 
>> difficulties.
>> My build.xml is use to compile many other elements.
>> Because of that build.xml is not located in the directory where are 
>> the jsp.
>> How can I declare the directory where are located the jsp files to 
>> translate ?
>>
>> Best regards
>>
>> Andre
>>
>> Tim Funk wrote:
>>
>>> You need common/lib/jasper-compiler.jar in your classpath. [And 
>>> probably a couple of other files in common/lib]
>>>
>>> -Tim
>>>
>>> Evgeny Gesin wrote:
>>>
>>>> Hi,
>>>> when I run that code I get this error "No public
>>>> no-arg constructor in class org.apache.jasper.JspC",
>>>> probably in "<taskdef>"
>>>>
>>>> What could be wrong?
>>>>
>>>> Evgeny
>>>>
>>>> --- Tim Funk <fu...@joedog.org> wrote:
>>>>
>>>>> Use this in your build.xml ...
>>>>>
>>>>>
>>>>> <target name="jsp-compile" depends="compile"
>>>>> description="prcompile the jsps">
>>>>> <!-- declare JspC task -->
>>>>> <taskdef classname="org.apache.jasper.JspC"
>>>>> name="jasper2" >
>>>>> <classpath refid="classpath"/>
>>>>> </taskdef>
>>>>>
>>>>> <!-- declare and make scratch dirs for the java
>>>>> files and classes -->
>>>>> <property name="jsp.src"
>>>>> value="${build.dir}/WEB-INF/jspc/src"/>
>>>>> <property name="jsp.classes"
>>>>> value="${build.dir}/WEB-INF/jspc/classes"/>
>>>>> <mkdir dir="${jsp.src}"/>
>>>>> <mkdir dir="${jsp.classes}"/>
>>>>>
>>>>> <!-- turn the jsp's into java files -->
>>>>> <jasper2 compile="false"
>>>>> validateXml="false"
>>>>> uriroot="${build.dir}"
>>>>>
>>>>
>>>> webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
>>>>
>>>>> addWebXmlMappings="true"
>>>>> outputDir="${jsp.src}" />
>>>>>
>>>>> <!-- compile java files -->
>>>>> <javac destdir="${jsp.classes}"
>>>>> optimize="off"
>>>>> debug="on" failonerror="false"
>>>>> srcdir="${jsp.src}"
>>>>> excludes="**/*.smap">
>>>>> <classpath refid="classpath"/>
>>>>> <include name="**" />
>>>>> </javac>
>>>>>
>>>>> <!--
>>>>> Take the compiled java files and put em in a
>>>>> jar
>>>>> You really don't need this step but I like jar
>>>>> files.
>>>>> -->
>>>>> <jar
>>>>> jarfile="${build.dir}/WEB-INF/lib/jsps.jar"
>>>>> index="false">
>>>>> <fileset dir="${jsp.classes}">
>>>>> <include name="**/*.class" />
>>>>> </fileset>
>>>>> </jar>
>>>>>
>>>>> <!-- Chuck build jsp src and classes -->
>>>>> <delete dir="${jsp.src}"/>
>>>>> <delete dir="${jsp.classes}"/>
>>>>>
>>>>> </target>
>>>>>
>>>>>
>>>>> -Tim
>>>>>
>>>>>
>>>>> Hofmann, Benjamin wrote:
>>>>>
>>>>>
>>>>>> How do I set up my Tomcat 5 to precompile all of
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> my JSP files?
>>>>>
>>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>>
>>>>> To unsubscribe, e-mail:
>>>>> tomcat-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail:
>>>>> tomcat-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> __________________________________
>>>> Do you Yahoo!?
>>>> New and Improved Yahoo! Mail - 100MB free storage!
>>>> http://promotions.yahoo.com/new_mail
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Precompiling JSP How To

Posted by Tim Funk <fu...@joedog.org>.
In the jasper2 task, the  uriroot="${build.dir}" is where the root of the web 
app is located. So you build.xml can be one place, the webapp root can be at 
another pllace, and the outputfiles from jspc (and compiled classes) can each 
be their own subdirectories.

-Tim

Andre Legendre wrote:

> Hi
> 
> I tried to use this build.xml. It help me alot but I still have some 
> difficulties.
> My build.xml is use to compile many other elements.
> Because of that build.xml is not located in the directory where are the 
> jsp.
> How can I declare the directory where are located the jsp files to 
> translate ?
> 
> Best regards
> 
> Andre
> 
> Tim Funk wrote:
> 
>> You need common/lib/jasper-compiler.jar in your classpath. [And 
>> probably a couple of other files in common/lib]
>>
>> -Tim
>>
>> Evgeny Gesin wrote:
>>
>>> Hi,
>>> when I run that code I get this error "No public
>>> no-arg constructor in class org.apache.jasper.JspC",
>>> probably in "<taskdef>"
>>>
>>> What could be wrong?
>>>
>>> Evgeny
>>>
>>> --- Tim Funk <fu...@joedog.org> wrote:
>>>
>>>> Use this in your build.xml ...
>>>>
>>>>
>>>> <target name="jsp-compile" depends="compile"
>>>> description="prcompile the jsps">
>>>> <!-- declare JspC task -->
>>>> <taskdef classname="org.apache.jasper.JspC"
>>>> name="jasper2" >
>>>> <classpath refid="classpath"/>
>>>> </taskdef>
>>>>
>>>> <!-- declare and make scratch dirs for the java
>>>> files and classes -->
>>>> <property name="jsp.src"
>>>> value="${build.dir}/WEB-INF/jspc/src"/>
>>>> <property name="jsp.classes"
>>>> value="${build.dir}/WEB-INF/jspc/classes"/>
>>>> <mkdir dir="${jsp.src}"/>
>>>> <mkdir dir="${jsp.classes}"/>
>>>>
>>>> <!-- turn the jsp's into java files -->
>>>> <jasper2 compile="false"
>>>> validateXml="false"
>>>> uriroot="${build.dir}"
>>>>
>>>
>>> webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
>>>
>>>> addWebXmlMappings="true"
>>>> outputDir="${jsp.src}" />
>>>>
>>>> <!-- compile java files -->
>>>> <javac destdir="${jsp.classes}"
>>>> optimize="off"
>>>> debug="on" failonerror="false"
>>>> srcdir="${jsp.src}"
>>>> excludes="**/*.smap">
>>>> <classpath refid="classpath"/>
>>>> <include name="**" />
>>>> </javac>
>>>>
>>>> <!--
>>>> Take the compiled java files and put em in a
>>>> jar
>>>> You really don't need this step but I like jar
>>>> files.
>>>> -->
>>>> <jar
>>>> jarfile="${build.dir}/WEB-INF/lib/jsps.jar"
>>>> index="false">
>>>> <fileset dir="${jsp.classes}">
>>>> <include name="**/*.class" />
>>>> </fileset>
>>>> </jar>
>>>>
>>>> <!-- Chuck build jsp src and classes -->
>>>> <delete dir="${jsp.src}"/>
>>>> <delete dir="${jsp.classes}"/>
>>>>
>>>> </target>
>>>>
>>>>
>>>> -Tim
>>>>
>>>>
>>>> Hofmann, Benjamin wrote:
>>>>
>>>>
>>>>> How do I set up my Tomcat 5 to precompile all of
>>>>
>>>>
>>>>
>>>> my JSP files?
>>>>
>>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>>
>>>> To unsubscribe, e-mail:
>>>> tomcat-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail:
>>>> tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> New and Improved Yahoo! Mail - 100MB free storage!
>>> http://promotions.yahoo.com/new_mail
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Precompiling JSP How To

Posted by Andre Legendre <ha...@yahoo.com>.
Hi

I tried to use this build.xml. It help me alot but I still have some 
difficulties.
My build.xml is use to compile many other elements.
Because of that build.xml is not located in the directory where are the jsp.
How can I declare the directory where are located the jsp files to 
translate ?

Best regards

Andre

Tim Funk wrote:

> You need common/lib/jasper-compiler.jar in your classpath. [And 
> probably a couple of other files in common/lib]
>
> -Tim
>
> Evgeny Gesin wrote:
>
>> Hi,
>> when I run that code I get this error "No public
>> no-arg constructor in class org.apache.jasper.JspC",
>> probably in "<taskdef>"
>>
>> What could be wrong?
>>
>> Evgeny
>>
>> --- Tim Funk <fu...@joedog.org> wrote:
>>
>>> Use this in your build.xml ...
>>>
>>>
>>> <target name="jsp-compile" depends="compile"
>>> description="prcompile the jsps">
>>> <!-- declare JspC task -->
>>> <taskdef classname="org.apache.jasper.JspC"
>>> name="jasper2" >
>>> <classpath refid="classpath"/>
>>> </taskdef>
>>>
>>> <!-- declare and make scratch dirs for the java
>>> files and classes -->
>>> <property name="jsp.src"
>>> value="${build.dir}/WEB-INF/jspc/src"/>
>>> <property name="jsp.classes"
>>> value="${build.dir}/WEB-INF/jspc/classes"/>
>>> <mkdir dir="${jsp.src}"/>
>>> <mkdir dir="${jsp.classes}"/>
>>>
>>> <!-- turn the jsp's into java files -->
>>> <jasper2 compile="false"
>>> validateXml="false"
>>> uriroot="${build.dir}"
>>>
>>
>> webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
>>
>>> addWebXmlMappings="true"
>>> outputDir="${jsp.src}" />
>>>
>>> <!-- compile java files -->
>>> <javac destdir="${jsp.classes}"
>>> optimize="off"
>>> debug="on" failonerror="false"
>>> srcdir="${jsp.src}"
>>> excludes="**/*.smap">
>>> <classpath refid="classpath"/>
>>> <include name="**" />
>>> </javac>
>>>
>>> <!--
>>> Take the compiled java files and put em in a
>>> jar
>>> You really don't need this step but I like jar
>>> files.
>>> -->
>>> <jar
>>> jarfile="${build.dir}/WEB-INF/lib/jsps.jar"
>>> index="false">
>>> <fileset dir="${jsp.classes}">
>>> <include name="**/*.class" />
>>> </fileset>
>>> </jar>
>>>
>>> <!-- Chuck build jsp src and classes -->
>>> <delete dir="${jsp.src}"/>
>>> <delete dir="${jsp.classes}"/>
>>>
>>> </target>
>>>
>>>
>>> -Tim
>>>
>>>
>>> Hofmann, Benjamin wrote:
>>>
>>>
>>>> How do I set up my Tomcat 5 to precompile all of
>>>
>>>
>>> my JSP files?
>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>
>>> To unsubscribe, e-mail:
>>> tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>>> tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> New and Improved Yahoo! Mail - 100MB free storage!
>> http://promotions.yahoo.com/new_mail
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Precompiling JSP How To

Posted by Tim Funk <fu...@joedog.org>.
You need  common/lib/jasper-compiler.jar in your classpath. [And probably a 
couple of other files in common/lib]

-Tim

Evgeny Gesin wrote:

> Hi,
> when I run that code I get this error "No public
> no-arg constructor in class org.apache.jasper.JspC",
> probably in "<taskdef>"
> 
> What could be wrong?
> 
> Evgeny
> 
> --- Tim Funk <fu...@joedog.org> wrote:
> 
>>Use this in your build.xml ...
>>
>>
>><target name="jsp-compile" depends="compile"
>>description="prcompile the jsps">
>>     <!-- declare JspC task -->
>>     <taskdef classname="org.apache.jasper.JspC"
>>name="jasper2" >
>>       <classpath refid="classpath"/>
>>     </taskdef>
>>
>>     <!-- declare and make scratch dirs for the java
>>files and classes -->
>>     <property name="jsp.src"
>>value="${build.dir}/WEB-INF/jspc/src"/>
>>     <property name="jsp.classes"
>>value="${build.dir}/WEB-INF/jspc/classes"/>
>>     <mkdir   dir="${jsp.src}"/>
>>     <mkdir   dir="${jsp.classes}"/>
>>
>>     <!-- turn the jsp's into java files -->
>>     <jasper2 compile="false"
>>              validateXml="false"
>>              uriroot="${build.dir}"
>>             
>>
> 
> webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
> 
>>              addWebXmlMappings="true"
>>              outputDir="${jsp.src}" />
>>
>>     <!-- compile java files -->
>>     <javac destdir="${jsp.classes}"
>>            optimize="off"
>>            debug="on" failonerror="false"
>>            srcdir="${jsp.src}"
>>        excludes="**/*.smap">
>>       <classpath refid="classpath"/>
>>       <include name="**" />
>>     </javac>
>>
>>     <!--
>>     	Take the compiled java files and put em in a
>>jar
>>     	You really don't need this step but I like jar
>>files.
>>     -->
>>     <jar
>>jarfile="${build.dir}/WEB-INF/lib/jsps.jar"
>>index="false">
>>        <fileset dir="${jsp.classes}">
>>           <include name="**/*.class" />
>>        </fileset>
>>     </jar>
>>
>>     <!-- Chuck build jsp src and classes -->
>>     <delete dir="${jsp.src}"/>
>>     <delete dir="${jsp.classes}"/>
>>
>>   </target>
>>
>>
>>-Tim
>>
>>
>>Hofmann, Benjamin wrote:
>>
>>
>>>How do I set up my Tomcat 5 to precompile all of
>>
>>my JSP files?
>>
>>>  
>>
>>
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Precompiling JSP How To

Posted by Evgeny Gesin <ev...@yahoo.com>.
Hi,
when I run that code I get this error "No public
no-arg constructor in class org.apache.jasper.JspC",
probably in "<taskdef>"

What could be wrong?

Evgeny

--- Tim Funk <fu...@joedog.org> wrote:
> Use this in your build.xml ...
> 
> 
> <target name="jsp-compile" depends="compile"
> description="prcompile the jsps">
>      <!-- declare JspC task -->
>      <taskdef classname="org.apache.jasper.JspC"
> name="jasper2" >
>        <classpath refid="classpath"/>
>      </taskdef>
> 
>      <!-- declare and make scratch dirs for the java
> files and classes -->
>      <property name="jsp.src"
> value="${build.dir}/WEB-INF/jspc/src"/>
>      <property name="jsp.classes"
> value="${build.dir}/WEB-INF/jspc/classes"/>
>      <mkdir   dir="${jsp.src}"/>
>      <mkdir   dir="${jsp.classes}"/>
> 
>      <!-- turn the jsp's into java files -->
>      <jasper2 compile="false"
>               validateXml="false"
>               uriroot="${build.dir}"
>              
>
webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
>               addWebXmlMappings="true"
>               outputDir="${jsp.src}" />
> 
>      <!-- compile java files -->
>      <javac destdir="${jsp.classes}"
>             optimize="off"
>             debug="on" failonerror="false"
>             srcdir="${jsp.src}"
>         excludes="**/*.smap">
>        <classpath refid="classpath"/>
>        <include name="**" />
>      </javac>
> 
>      <!--
>      	Take the compiled java files and put em in a
> jar
>      	You really don't need this step but I like jar
> files.
>      -->
>      <jar
> jarfile="${build.dir}/WEB-INF/lib/jsps.jar"
> index="false">
>         <fileset dir="${jsp.classes}">
>            <include name="**/*.class" />
>         </fileset>
>      </jar>
> 
>      <!-- Chuck build jsp src and classes -->
>      <delete dir="${jsp.src}"/>
>      <delete dir="${jsp.classes}"/>
> 
>    </target>
> 
> 
> -Tim
> 
> 
> Hofmann, Benjamin wrote:
> 
> > How do I set up my Tomcat 5 to precompile all of
> my JSP files?
> > 
> >   
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 



	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Precompiling JSP How To

Posted by Tim Funk <fu...@joedog.org>.
Use this in your build.xml ...


<target name="jsp-compile" depends="compile" description="prcompile the jsps">
     <!-- declare JspC task -->
     <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
       <classpath refid="classpath"/>
     </taskdef>

     <!-- declare and make scratch dirs for the java files and classes -->
     <property name="jsp.src" value="${build.dir}/WEB-INF/jspc/src"/>
     <property name="jsp.classes" value="${build.dir}/WEB-INF/jspc/classes"/>
     <mkdir   dir="${jsp.src}"/>
     <mkdir   dir="${jsp.classes}"/>

     <!-- turn the jsp's into java files -->
     <jasper2 compile="false"
              validateXml="false"
              uriroot="${build.dir}"
              webXmlFragment="${build.dir}/WEB-INF/generated_web.xml"
              addWebXmlMappings="true"
              outputDir="${jsp.src}" />

     <!-- compile java files -->
     <javac destdir="${jsp.classes}"
            optimize="off"
            debug="on" failonerror="false"
            srcdir="${jsp.src}"
        excludes="**/*.smap">
       <classpath refid="classpath"/>
       <include name="**" />
     </javac>

     <!--
     	Take the compiled java files and put em in a jar
     	You really don't need this step but I like jar files.
     -->
     <jar jarfile="${build.dir}/WEB-INF/lib/jsps.jar" index="false">
        <fileset dir="${jsp.classes}">
           <include name="**/*.class" />
        </fileset>
     </jar>

     <!-- Chuck build jsp src and classes -->
     <delete dir="${jsp.src}"/>
     <delete dir="${jsp.classes}"/>

   </target>


-Tim


Hofmann, Benjamin wrote:

> How do I set up my Tomcat 5 to precompile all of my JSP files?
> 
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org