On Wed, Mar 31, 2004 at 02:55:16PM +0200, Malcolm Warren wrote:
: Now when I transfer everything to my production server I would like to
: eliminate all of the .jsp pages from the application, and all of the .java
: files, and just send a .jar file containing the .class files in
: /work/Standalone/localhost/$applicationDir.
You can do this.
Sort of.
That's what precompilation is all about.
Please bear with me:
- JSPs get compiled down to servlets, either by you (precompiling) or by
the container (at runtime).
- when the container compiles a JSP for you, it takes care of mapping
the servlet to the context-relative URI that matches the JSP. So
/x/y.jsp is mapped, behind the scenes, to some.package.x.y_jsp.class.
To precompile the JSPs means you must tell Tomcat yourself which
classes map to given URIs. Hence the autogenerated file full of
<servlet> and <servlet-mapping> entries I described in my last
message.
- When you precompile, you have can even put the classes into a jar file,
but that jar file must be in {dist}/WEB-INF/lib. That's the only way
Tomcat's classloader will find the jar.
- With the JSPs compiled down to code, and properly mapped in web.xml,
you can remove the JSPs from your app.
See
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/printer/jasper-howto.html#Web%20Application%20Compilation
for more details on the precompilation process (assuming TC5). It
mentions the generated web.xml fragment of which I spoke.
: That way the compilation is already done, and nobody can study my .jsp
: files. In theory I could just create a directory tree somewhere of
: org/apache/jsp/ copy all the automatically generated .class files into
: this directory tree and .jar it all up, and Tomcat should find them either
: in /WEB-INF/lib or in /work/Standalone/localhost/$applicationDir, but it
: doesn't.
Close, except that the jar of JSPs must exist in {dist}/WEB-INF/lib.
Tomcat won't load a jar from the context dir itself, aka
".....//localhost/$applicationDir." Just not how Tomcat works. ;)
-QM
--
software -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]