There are three methods. I like #1, I used #3 up until a while ago.
Anyway, here they are.
My major criticism of method #3 is that all the machine/port/etc..
settings should either be passed in on the command line, put in static
final Strings, or loaded using a properties file.
- John
1) If you use ANT or can use ant... Put the following in the build
script.
<!-- JSPC Precompile -->
<target name="jspc" depends="init">
<java fork="yes" classname="org.apache.jasper.JspC">
<arg line="-uriroot /your/Catalina_home/webapps/context -d
/your/Catalina_home/WEB-INF/classes -p jsp -webapp
/your/Catalina_home/webapps/context" />
</java>
</target>
(from Jay Gardner's Message 04/08/2002 help with JspC)
2) Touch each url for each jsp page and include ?jsp_precompile in the
url.
3) Write a small program to do method 2 for you.
>From Professional JSP Second Edition (wrox) (pretty decent book too,
simple examples and such)
<code below this line>
package com.wrox.projsp.ch03.util;
import java.io.File;
import java.io.IOException;
import java.net.URL;
public class Precompile {
public static void main(String[] args) {
String pathname = args[0];
String queryString = "?jsp_precompile";
String urlBase = "/chapter04/jsp/";
try {
File dir = new File(pathname);
if (!dir.exists()) {
throw new IOException("pathname " + pathname + " not found");
}
File[] files = dir.listFiles();
for (int i = 0; i < files.length; i++) {
String jspFile = files[i].getName();
if (jspFile.endsWith(".jsp")) {
System.out.println("working on " + files[i].getName());
try {
URL url = new URL("http", "127.0.0.1", 8080,
urlBase + jspFile + queryString);
System.out.println("compiling " + jspFile + " using " +
urlBase
+ jspFile + queryString);
url.getContent();
} catch (Exception e) {
// add error handling
}
}
}
} catch (Exception e) {
System.out.println("exception raised:" + e);
}
}
}
<code above this line>
-----Original Message-----
From: Christophe Reynaud [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 01:35 PM
To: Tomcat Users List
Subject: How to pre-compile JSP's ?
Do you know if there is a simple solution to pre-compile the JSP's ?
(And
to tell tomcat not to re-compile the JSP's ?)
Thanks
Jay Gardner wrote:
> There are definitely memory leaks in javac. This is a problem when
jspc
> compiles your jsp code in the same JVM as the TC server.
>
> --Jay Gardner
>
> -----Original Message-----
> From: Christophe Reynaud [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 09, 2002 12:52 PM
> To: Tomcat Users List
> Subject: Tomcat process takes 246M whereas total java heap is 127M
>
> Hello,
>
> We use tomcat 3.3.1 on Linux RH 7.2. JVM : IBM 1.3
>
> "top -c" tells that the tomcat threads take 246M but if we use the
Java
> function "totalMemory()", it tells that the JVM uses 127M for the
heap.
> Where is the rest of memory ? I expected that the JVM used more than
> only the total of the heap, but in this case it is almost the double !
> Any ideas about the reasons of this problem ? Are there some momory
> leaks in the JVM ?
>
> Thanks.
>
> Christophe
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>