tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikola Milutinovic" <Nikola.Milutino...@ev.co.yu>
Subject Re: Precompile JSP
Date Fri, 16 Nov 2001 07:06:08 GMT
> > Try bin/jspc.bat or jspc.sh
> 
> I would like to compile my jsp's as a test before I deploy it and see if it
> works. I spend quite a lot of time changing stuff, deploying, loading in a
> web browser and seeing jsp compiliation problems.
> 
> It would be nice to have jspc compile my jsp's during the deployment
> process. I tried this and it seems to recompile everything, rather than only
> those files that have changed.
> 
> Is there a depends option to jspc?
> 
> The obvious solution is to use ant to only compile those files that have
> changed, but there doesn't seem to be an equivelent of make's .c.o option in
> ant. Is there a dependset creator anywhere, if there isn't a generic .c.o
> type task?

:-)

When a JSP page is requested, Servlet Container will fire up JSP servlet, which will check
if there is a compiled servlet for that page and if it is newr than the page itself. If so,
it will transfer (forward) to that servlet. If not, it will startup JSP compiler, to turn
JSP page into a Java source. Then it will feed that Java source to Java compiler from JDK
to finaly produce the servlet and run it. Those run-time compiled servlets are kept in a work
dir.

When you "deploy" or just unload/load a context, it's work dir is empty, so it must be compiled
the first time it is requested. OR YOU CAN...

1. Precompile them manually, move teh resulting *.class files to WEB-INF/classes/... and edit
web.xml to register all those servlets and their mappings

2. Run a startup servlet, which will precompile all JSPs in your webapp (request them with
URL "/path/file.jsp?precompile=true", I think)

The first aproach nails it shut, all changes will have to be made on your development machine.
The second leaves things open, at the cost of a rather slow startup.

Nix.
Mime
View raw message