tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
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 <ralph.einfeldt@uptime-isc.de>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> Subject: RE: Problem with invalidating a session
>
> See below:
>
> > -----Original Message-----
> > From: Tim Funk [mailto:funkman@joedog.org]
> > 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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message