tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uri Cohen" <...@proficiency.com>
Subject RE: Precompiled JSPs
Date Sun, 15 Jul 2001 14:50:05 GMT
Already did everything. My problem was not the mapping or the location
of servlets. The problem is in some servlets, which do not save the
session of the user (They are successfully located and activated, but
the session id is not passed to them properly, so the user session
cannot beb restored). I think the JspServlet, which is responsible for
the compilation and redirection of requests to the proper generated
servlet encodes the URL of sets a cookie in the user's browser, which is
why everything works fine in normal JSPs.

-----Original Message-----
From: Oskar Zinger [mailto:oskar.zinger@micromuse.com]
Sent: Thursday, July 12, 2001 7:27 PM
To: tomcat-user@jakarta.apache.org
Cc: Uri Cohen
Subject: Re: Precompiled JSPs


Hi Uri,
You have to compile your JSPs with -webxml and -webapp options.  This
option will create a web.xml file with all the required servlet mapping
and everything will work fine.

I ran such command:
jspc.sh -p <package name> -dd <directory there to output translate java
files> -webxml <path where to store a web.xml file (i.e. /temp/web.xml)>
-webapp <directory of your webapp where all the JSPs reside>

After the web.xml file is produced you have incorporate it with your
tomcat original web.xml file.

Or you could create a servlet mapping for your jsps manually.  In the
following way:
<servlet>
   <servlet-name>com.somecompany.pacakge.SomeJsp</servlet-name>
   <servlet-class>com.somecompany.pacakge.SomeJsp</servlet-class>
<servlet>
.
.  you need to put all servlet tags first (for each jsp)
.  then servlet-mapping tags go (for each jsp)
.
<servlet-mapping>
   <servlet-name>com.somecompany.pacakge.SomeJsp</servlet-name>
   <url-pattern>/SomeJsp.jsp</url-pattern>
</servlet-mapping>

This way you do not need to change urls in your original JSPs to class
names, you can just use the same urls in your JSPs and pre-compiled
JSPs.

Hope this helps,
Oskar

Uri Cohen wrote:

> I precompiled all my JSPs in the application, using jspc. Most pages
> work OK, but there are some pages which don't. For some reason, when
> loading these pages the session is lost, causing many errors. I solved
> the problem by sending the request parameter JSESSIONID when calling
> these pages.
> These pages worked fine as regular JSPs, and this symptom only occures
> when I use them as servlets.
> Has anyone encountered such a problem?


Mime
View raw message