"G. Goerke" wrote:
>
> Hello!
>
> I've got some troubles using session-tracking between servlets and jsp's. I've tried
> it using the web-servers LWS from Gefion and tomcat 3.0 and 3.1.
>
> My first choice was the LWS, because it supports URL-Rewriting and I don't want to
> use cookies. But everytime I switch from a servlet to an jsp or back, 
>request.getSession()
> provides a new session-object, although switching between two servlets or to jsp's 
>is no problem.
> Therefore my first question is:
> Doesn't LWS support session-tracking between servlets and jsps or is there a trick, 
>I need to know?

A possible cause for the behavior you see is that your servlet and JSP pages are
actually in two different servlet contexts (applications).

Using the default LWS configuration as an example, if you invoke your
servlet with a URL like

  /servlet/foo

it's served by the default context. If you then invoke your JSP page
with a URL like

  /examples/foo.jsp

it's served by the examples context. The two contexts have separate sessions,
as per the Servlet 2.2 spec.

If this is the case, simple change the way you call the servlet to

  /examples/servlet/foo

or define an explicit mapping for the servlet in the examples context, instead
of using the invoked mapped to /servlet/*. You can then invoke the servlet
with a URL like

  /examples/foo


> My second choice tomcat 3.0 works fine and I got no problem mixing jsp's with
> servlets. But it doesn't support URL-rewriting.
> Someone some time ago wrote, that tomcat 3.1 would support URL-rewriting, so I
> tried it today. But unfortunately it didn't encode the URLs. And to my surprise
> it reports two different session-ids in jsp's and servlets although they both seem
> to belong to the same instance!

Tomcat 3.1 RC1 supports URL rewriting.

  <http://jakarta.apache.org/builds/tomcat/release/v3.1_rc1/>

I can't say I've done any extensive testing, but based on a few simple tests
(using only JSP pages) it seems to work. The problems you have with Tomcat may
be
caused by the same thing as I described for LWS above.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to