× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Gilles,

A redirect should not cause you to lose your session. If you
switch contexts I believe you would. Are you sure that you
are not switching from one context to another? It looks like
you are using WebSphere, which does not necessarily
conform to the servlet specification, but you should have
Context entry in a server.xml file.

With Tomcat, which does conform to the servlet spec, a
Manager keeps track of sessions. With Tomcat 4.0.1, you
can actually shut down the server and restart with your
sessions intact. This does depend somewhat on you
making your code serializable (you don't have to
implement serializable unless you force this) and test
for the session objects properly.

David Morris

>>> Gilles.DUCRET@lloydsbank.ch 02/13/02 01:08AM >>>
This message is in MIME format. Since your mail reader does not
understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
It is in the Websphere Test Environment.

I am just migrating code from VAJ3.5 to VAJ4.

I had problems because we used sendRedirect instead of forward.

I have changed the code and used forward to call JSPs from servlets,
and servlets from servlets, etc ...

When I forward from the servlet to the JSP it is ok, I can
find the information in the session. When I call another servlet
(from an hyperlink, or typing the url), when I enter in the second
servlet code, the session id is different.

We have implemented an MVC model based on an article found in VADD.
Each servlet derives from a base class, and in this base class we
get the information from the session.
The code is _session = request.getSession(true);

Why in some case it creates a new session and in others no?

Gilles

-----Original Message-----
From: Gary L Peskin [mailto:garyp@firstech.com]
Sent: mardi, 12. février 2002 17:54
To: java400-l@midrange.com
Subject: RE: JSP


Gilles -

What container are you running this in?  Depending on the container,
there may be certain setup requirements where you have to tell the
container that you want to use sessions, what the session timeout is,
etc.  How are you identifying sessions?  In other words, how does the
container match an interaction to a stored session?  Are you using
cookies or URL rewriting or some other means?

If your code is working, I suspect the session support is not properly
set up for the container.  However, without knowing what servlet
engine
you're using, it's difficult to go further.

Gary

> -----Original Message-----
> From: java400-l-admin@midrange.com
> [mailto:java400-l-admin@midrange.com] On Behalf Of Ducret, Gilles
(CH)
> Sent: Tuesday, February 12, 2002 8:34 AM
> To: JAVA400-L (E-mail)
> Subject: JSP
>
>
> This message is in MIME format. Since your mail reader does
> not understand this format, some or all of this message may
> not be legible.
> --
> [ Picked text/plain from multipart/alternative ]
> Hello,
>
> I have a very strange problem and I cannot find where
> it comes from.
>
> I have a first servlet, that put some information into
> the session. This servlet then calls a jsp to display information.
>
> The jsp displays the information plus an hyperlink to another
servlet.
>
> When I clic on that link and enter the servlet code, I cannot
> find anymore the object in the session. The session ID has
> also changed. In fact a new session has been created for this
servlet.
>
> What can make a new session to be created?
>
> The link is:
>
> <a href="servlet/MyServlet">Test my servlet</a>
>
> Thanks
>
> Gilles


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.