> -----Original Message-----
> From: Billy Ng [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 29, 2002 9:40 AM
> To: [EMAIL PROTECTED]
> Subject: First time penatly
> 
> Hi folks,
> 
> Everytime I start or restart the app, the user will 
> experience the slowness 
> becuase the jsp pages have to be compiled.  Long time ago, I 
> read a book 
> saying there is a way to pre-compile the jsp files to avoid 
> this first time 
> penatly, but I can't make it work.  Would anybody tell me how to do 
> pre-compile, thanks!

This has nothing to do with Struts.  This is a web container issue.  Read
your web container docs.

In short, there are two basic ways to do this:

Write a single servlet that nudges the web container to compile all of your
JSP pages.  I believe several web containers already provide a feature to do
this, including Tomcat.

Alternatively, all web containers have a command-line class, often called
something like "JspC", which will generate the servlet source code from the
JSP pages.  After you generate the servlet source code, you have to use the
java compiler to compile them, and you'll also most likely have to insert
"<servlet>" and "<servlet-mapping>" elements in your "web.xml" file for each
one of those generated servlets.

The tradeoff between these two strategies is that the first one is often
much easier (if the web container provides the servlet), but the second one
provides for a more robust build process, as you'll see more possible errors
in your build, as opposed to after it's deployed.  On the other hand, the
second strategy causes you to deploy a war file that is web-container
specific.

The JspC class in some containers also compile the generated servlet at the
same time.  Some of these web containers may either generate the "web.xml"
fragment that needs to be inserted, or modify the "web.xml" directly with
the updated mappings.

Look for features like these in your web container docs and experiment.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to