On Wed, 8 Jan 2003, Ralph Einfeldt wrote:

> Date: Wed, 8 Jan 2003 14:53:22 +0100
> From: Ralph Einfeldt <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: RE: Problem with invalidating a session
>
> See below:
>
> > -----Original Message-----
> > From: Tim Funk [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 08, 2003 2:14 PM
> > To: Tomcat Users List
> > Subject: Re: Problem with invalidating a session
>
> > Your code invalidates the session. getSession(true) is returning a
> > reference to session you just the invalidated.
>
> No it's a new session. (getId() returns a different value)
>

As it should be.

> If that would be the problem the exception would already be
> thrown in 'session.putValue("Test", "Test")', but it is thrown
> in PageContextImpl.getAttribute() (which part of the generated
> code for use bean) if the scope of the bean is session.
>
> The real problem is, that pageContext has still a reference
> the the invalidated session.
>

This is an issue only for JSP pages -- the PageContext implementation
variable's contents (and the local scripting variable "session") are only
synchronized with reality at the beginning of the page (plus the extra
synchronization that happens for attributes at the beginning and ending of
tags, but that doesn't solve your problem.

If you want to switch sessions in the middle of a request, do it in a
servlet, not a JSP page.

More generally, if you want to do business logic in the middle of a
request, do it in a servlet not in a JSP page :-).  You will find MVC
frameworks like Struts <http://jakarta.apache.org/struts/> make this an
easy thing to set up.

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to