You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by motit <Mo...@expand.com> on 2008/12/22 10:18:49 UTC

Using precompiled JSPs

Hi
I am using tomcat 6.
I compiled my JSPs (using tomcat’s org.apache.jasper.JspC) and located them
at the same place as all my classes in the WAR (WEB-INF/classes).
When running tomcat and browsing to some JSP files, I found out the tomcat
translate the JSPs to servlets and compile them again under the “work”
directory.
What is the reason it doesn’t use the compiled JSP and recompile the JSP
from scratch?
What should be done to use precompiled JSP in tomcat? (I followed the tomcat
instructions)

Thanks in Advance,
Moti

My JSP seetings in the web.xml looks like that:
<servlet-name>JspServlet</servlet-name>
      <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
      <init-param>
         <param-name>development</param-name>
         <param-value>false</param-value>
      </init-param>
      <init-param>
         <param-name>fork</param-name>
         <param-value>false</param-value>
      </init-param>
      <init-param>
         <param-name>reloading</param-name>s
         <param-value>false</param-value>
      </init-param>      
      <init-param>
         <param-name>classpath</param-name>
      <init-param>
         <param-name>xpoweredBy</param-name>
         <param-value>false</param-value>
      </init-param>
      <init-param>
         <param-name>checkInterval</param-name>
         <param-value>false</param-value>
      </init-param>
      <init-param>
         <param-name>classdebuginfo</param-name>
         <param-value>true</param-value>
      </init-param>
      <load-on-startup>3</load-on-startup>
   </servlet>



-- 
View this message in context: http://www.nabble.com/Using-precompiled-JSPs-tp21124710p21124710.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Using precompiled JSPs

Posted by motit <Mo...@expand.com>.
Thanks, its work.
The jsp mapping wasn't set correctly. 
-- 
View this message in context: http://www.nabble.com/Using-precompiled-JSPs-tp21124710p21196649.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Using precompiled JSPs

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: motit [mailto:Moti.Tal@expand.com]
> Subject: RE: Using precompiled JSPs
>
> 1. see my ant script below

You should be using the one from the Tomcat doc; yours fails to perform a couple of critical steps.

> 2. I didn't change the jasper's package name hierarchy
> (e.g org.apache.jsp)

But did you use it when putting your class files under WEB-INF/classes?

> 3. I did update my war's web.xml with the jspservet
> mapping with *.jsp

Unnecessary and a complete waste of time.  It's inclusion of the mappings for the generated servlets that's critical.

> 4.      I have assisted by
> http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html

That's the correct doc, but since you didn't use the published script, you didn't generate the necessary servlet mappings.  Use the correct script, and make sure you perform this part:

"Then, the declarations and mappings for the servlets which were generated during the precompilation must be added to the web application deployment descriptor. Insert the ${webapp.path}/WEB-INF/generated_web.xml at the right place inside the ${webapp.path}/WEB-INF/web.xml file."

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Using precompiled JSPs

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
http://people.apache.org/~fhanik/precompile.html

Filip

motit wrote:
> 1.	see my ant script below
> 2.	I didn’t change the jasper’s package name hierarchy (e.g org.apache.jsp)
> 3.	I did update my war’s web.xml with the jspservet  mapping  with *.jsp 
> 4.	I have assisted by
> http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html
>
> <target name="compile.jsp">
>             <taskdef classname="org.apache.jasper.JspC" name="jasper" >
>                   <classpath>
>                     <fileset dir="${tomcat.home}/lib">
>                         <include name="jasper.jar"/>
>                         <include name="jasper-el.jar"/>
>                         <include name="servlet-api.jar"/>
>                         <include name="jsp-api.jar"/>
>                         <include name="el-api.jar"/>
>                     </fileset>
>                     <fileset dir="${tomcat.home}/bin">
>                         <include name="tomcat-juli.jar"/>
>                     </fileset>                    
>                 </classpath>
>             </taskdef>
>             <jasper uriRoot="{jsp.src}" outputDir="{temp}"/>
>
> <javac srcdir="{temp}"
> destdir="${tomcat.home}/${webapp.path}/WEB-INF/classes" debug="on"
> verbose="true">
>                   <classpath>
>                       …
>                 </classpath>
>             </javac>
>         </target>
>
> Thanks
> Moti
>
>
>   


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


RE: Using precompiled JSPs

Posted by motit <Mo...@expand.com>.
1.	see my ant script below
2.	I didn’t change the jasper’s package name hierarchy (e.g org.apache.jsp)
3.	I did update my war’s web.xml with the jspservet  mapping  with *.jsp 
4.	I have assisted by
http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html

<target name="compile.jsp">
            <taskdef classname="org.apache.jasper.JspC" name="jasper" >
                  <classpath>
                    <fileset dir="${tomcat.home}/lib">
                        <include name="jasper.jar"/>
                        <include name="jasper-el.jar"/>
                        <include name="servlet-api.jar"/>
                        <include name="jsp-api.jar"/>
                        <include name="el-api.jar"/>
                    </fileset>
                    <fileset dir="${tomcat.home}/bin">
                        <include name="tomcat-juli.jar"/>
                    </fileset>                    
                </classpath>
            </taskdef>
            <jasper uriRoot="{jsp.src}" outputDir="{temp}"/>

<javac srcdir="{temp}"
destdir="${tomcat.home}/${webapp.path}/WEB-INF/classes" debug="on"
verbose="true">
                  <classpath>
                      …
                </classpath>
            </javac>
        </target>

Thanks
Moti


-- 
View this message in context: http://www.nabble.com/Using-precompiled-JSPs-tp21124710p21129968.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Using precompiled JSPs

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: motit [mailto:Moti.Tal@expand.com]
> Subject: Using precompiled JSPs
>
> I compiled my JSPs (using tomcat's org.apache.jasper.JspC)

Did you use the suggested ant script, or did you roll your own mechanism?

> and located them at the same place as all my classes in the
> WAR (WEB-INF/classes).

Under the proper package name hierarchy?

> I found out the tomcat translate the JSPs to servlets and
> compile them again under the "work" directory.

You likely did not update your WEB-INF/web.xml with the servlet mappings.

> (I followed the tomcat instructions)

Exactly which instructions did you follow?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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