You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Malcolm Warren <ma...@villeinitalia.com> on 2004/04/01 11:04:21 UTC

Re: Of .war and .jar files - and .jsp class files

Dear QM,

Just a footnote to this problem, if you're interested.
The difference between Tomcat and Jrun on this problem of packing up the 
automatcally-generated .class files for .jsps is considerable, and I have 
to say that in this case Jrun looks more logical. With Tomcat, as you have 
explained, in order to get it to work you have to create all the servlet 
mappings.

This wasn't necessary in Jrun, because you simply put a .jar file in place 
of the unpacked classes, and the servlet container had no trouble finding 
them, because the .jar file was in exactly the same place as the unpacked 
.class files.

For some reason there isn't this easy relationship between the location of 
the tomcat-generated .class files and the path through the file system. 
The automatically generated .class files in Tomcat are in the 
org.apache.jsp package, but the folders /org/apache/jsp aren't there in 
the file system, if you see what I mean. It would have been nice if the 
package logic had been followed through.

Regards,
Malcolm Warren



On Wed, 31 Mar 2004 09:50:41 -0600, QM <qm...@brandxdev.net> wrote:

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



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Of .war and .jar files - and .jsp class files

Posted by Malcolm Warren <ma...@villeinitalia.com>.
That's not quite what I meant, but I shan't want to bother people any more 
with this question.
I can get along with what you told me in another email.

Thanks for you time.
Malcolm Warren

On Thu, 1 Apr 2004 09:06:51 -0600, QM <qm...@brandxdev.net> wrote:

>
> : The automatically generated .class files in Tomcat are in the
> : org.apache.jsp package, but the folders /org/apache/jsp aren't there in
> : the file system, if you see what I mean. It would have been nice if the
> : package logic had been followed through.
>
> ?
> I'm not sure I follow.
> I just checked my own jar of precompiled JSPs and saw the following:
>
> 	org/apache/jsp/index_jsp.class
> 	(etc, etc ...)
>
> Perhaps I missed this in your original post: do you run Tomcat4 or 5?
>
> My knowledge of (Tomcat) precomp is solely from the 5.x series.
>
> -QM
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Of .war and .jar files - and .jsp class files

Posted by QM <qm...@brandxdev.net>.
: The automatically generated .class files in Tomcat are in the 
: org.apache.jsp package, but the folders /org/apache/jsp aren't there in 
: the file system, if you see what I mean. It would have been nice if the 
: package logic had been followed through.

?
I'm not sure I follow.
I just checked my own jar of precompiled JSPs and saw the following:

	org/apache/jsp/index_jsp.class
	(etc, etc ...)

Perhaps I missed this in your original post: do you run Tomcat4 or 5?  

My knowledge of (Tomcat) precomp is solely from the 5.x series.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org