tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <ralph.einfe...@uptime-isc.de>
Subject Problem with invalidating a session
Date Wed, 08 Jan 2003 12:34:42 GMT

I have following little jsp:

<html><head><title></title></head><body>
<%

  // Stripped down to the bare minimum. In the real life
  // this is intended to happen only on specific conditions
  session.invalidate();
  session = request.getSession(true);

  // Now there is a new session
  session.putValue("Test", "Test");

%><jsp:useBean
   id="testbean"
   class="java.lang.String"
   scope="session"
/>
Some Content (Only reached with Scope != session)
</body></html>

The useBean with scope session fails as the pageContext
holds a reference to the invalidated session.
That causes tomcat to throw a IllegalStateException:
getAttribute: Session already invalidated

Although I quite understand why this happens, I couldn't find
in the 1.2 Spec anything that denies this kind of usage.

Is the spec just not precise enough or am I to blind to see it ?

Has anybody a solution to work around this problem beside using 
a response.redirect() directly after invalidating the session?

BTW: Please don't shout 'Do not use scriptlets in jsps', the
code has to run in a jsp engine that doesn't support taglibs 
and filters. 



--
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