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 Steve Loughran
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

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.

You cant guarantee that Jasper code is compatible with anything other
than the same version of tomcat; you need to use whatever jspc compiler
your app server ships with. Unless you run on tomcat, is only good for
catching errors before you deploy. But as deploy-by-copy is so easy, I
prefer to skip this stage and not waste any time getting jspc to work.

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

I do what John suggests and use HttpUnit.

1. you need those tests anyway
2. you can fetch all pages, including error pages and those that need
auth (if your tests log in first)
3. you can also walk every link from the index page and verify you have
no broken links

the hard part is writing the tests with side effects; the ones that add
stuff to the shopping basket and pay for them, or which move money
between bank accounts. But you know what? You need them anyway.

in a dev env, you deploy, run the tests while you go get a coffee and
all is well. On production, you can run the tests on the live system
immediately after every deployment.

Really, if you dont use httpunit, now is the time to learn :)


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

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