Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
How to compile jsp files with ANT

How to compile jsp files with ANT

2007-02-21       - By Rashmi Rubdi
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Hi James,

I use the Jasper task to mainly reduce the time it takes to load a JSP page.

I only execute the Jasper task just before creating the WAR file for the
production environment.

On the production environtment that gets multiple visitors throughout the day,
every time someone makes the *first* request to a particular JSP page - the
container's compiler compiles it for the first time.

This is fine if the application is small but if the app has too many JSP pages
then, the container would compile each and every JSP page just once thus
slowing the overall application response time especially if multiple users are
accessing different parts of the web app at the same time. Pre-compiling the
JSPs makes the web application response time much faster because the container
only serves the class file.

If you refer to the JSP 2.0 Final Release Specification (PDF) jsp-2_0-fr-spec
.pdf on page 1-7 , it lists all the benefits of pre-compiling JSPs.

I don't use the Jasper task for the development environment though, because one
wouldn't mind a negligible wait for just one JSP page in the development
environment and
also because the Jasper task takes a very long time to complete, it is not
suitable for a dev build but only for production build.

-Regards
Rashmi

----- Original Message ----
From: James Abley <james.abley@(protected)>
To: Ant Users List <user@(protected)>
Sent: Wednesday, February 21, 2007 3:12:40 AM
Subject: Re: How to compile jsp files with ANT


Why do you want to do this; e.g. is it part of a check to make sure that
all JSP pages will compile? Typically, you'd get better results by using
httpunit or a spider of sort sort to access every page and check that it
doesn't come back with a 500 response. That way, you are using the
deployment target container mechanism to compile the JSPs.

James

Rashmi Rubdi wrote:
> Hi Lokesh,
>
> I'm assuming you want to pre-compile JSPs. You can use Jasper for that.
>
> Take a look at the Jasper ANT task here:
> http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html
>
> The pre-compilation process first converts all JSP files to .java files and
then compiles them into class files, it will also modify web.xml
> to create a servlet mapping of every JSP class file.
>
> for example:
>
>     <servlet>
>         <servlet-name>org.apache.jsp.web._005fterms.copyright_jsp</servlet
-name>
>         <servlet-class>org.apache.jsp.web._005fterms.copyright_jsp</servlet
-class>
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>org.apache.jsp.web._005fterms.copyright_jsp</servlet
-name>
>         <url-pattern>/web/_terms/copyright.jsp</url-pattern>
>     </servlet-mapping>
>
> I guess that's what you are looking for.
>
> -Rashmi
>
> ----- Original Message ----
> From: Lokesh Jayaraman <lokesh.jayaram@(protected)>
> To: user@(protected)
> Sent: Tuesday, February 20, 2007 4:41:55 AM
> Subject: How to compile jsp files with ANT
>
>
> Dear,
>
> How to compile JSP files using ANT and Websphere Application Server 6.0
> and also use websphere's java compiler and libraries
> Kindly help me to solve this pbm
> by
> Lokesh
>
>
>
> _____________________________________________________________________________
_______
> Sucker-punch spam with award-winning protection.
> Try the free Yahoo! Mail Beta.
> http://advision.webevents.yahoo.com/mailbeta/features_spam.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



_______________________________________________________________________________
_____
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.