tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject RE: Problem with invalidating a session
Date Wed, 08 Jan 2003 20:04:52 GMT

On Wed, 8 Jan 2003, Ralph Einfeldt wrote:

> Date: Wed, 8 Jan 2003 14:53:22 +0100
> From: Ralph Einfeldt <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: RE: Problem with invalidating a session
> See below:
> > -----Original Message-----
> > From: Tim Funk []
> > 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 <> make this an
easy thing to set up.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message