Java Mailing List Archive

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     >>  

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

>I would suggest you take a closer look at my original suggestion. If you
>use the Jasper task, then I would think that the compiled versions of
>the JSP aren't portable off Tomcat. e.g.

>public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
>     implements org.apache.jasper.runtime.JspSourceDependent {

Good point, the portability issue didn't occur to me.

As far as I can remember, we used the Jasper task on a website that was built
only on
Tomcat  (on top of Apache HTTP server) accross multiple environments (
development, staging, QA and production)
and we didn't use any other 3rd party web server for example - Weblogic,
Websphere etc.

From your suggestion, it seems that our application would not run if we had
different web servers (e.g Weblogic, Websphere)
on other environments like staging or QA.

I guess the page response time was a greater issue that was to be addressed in
comparison to the portability of the application in
the case of that particular web application.

The production website for the web application would receive about 500 hits a
day, and the project
team was simply trying to make the web application response time as low as
possible to
improve the end-user experience.

Since the OP is using Websphere, I guess he could use this documentation
.websphere.base.doc/info/aes/ae/trun_app_instwiz.html  for reference
incase he was using Websphere in all environments and wanted to pre-compile the

>Your target container _may_ provide a mechanism for compiling JSPs,
>otherwise you _do_ need to request each page as part of your deployment
>strategy to make sure that they have been compiled.


Rashmi Rubdi wrote:
> 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:
>> 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
>>         <servlet-class>org.apache.jsp.web._005fterms.copyright_jsp</servlet
>>     </servlet>
>>     <servlet-mapping>
>>         <servlet-name>org.apache.jsp.web._005fterms.copyright_jsp</servlet
>>         <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.

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

©2008 - Jax Systems, LLC, U.S.A.