aspose file tools*
The moose likes JSP and the fly likes creating new session after invalidation in same request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "creating new session after invalidation in same request" Watch "creating new session after invalidation in same request" New topic
Author

creating new session after invalidation in same request

Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
Hi everyone,

I know that if a session gets invalidated, the next request creates a new one. But is it possible to create a new session in the same request as the invalidation? request.getSession() seems to return the invalidated session.

I guess a response.redirect() will automatically create a new request, but that would lose all the request parameters and I heard redirection can sometimes be disabled by clients and/or firewalls.

Thanks in advance,
Yuriy
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

>I know that if a session gets invalidated, the next request creates a new one.
well, yes, if its a jsp.

>But is it possible to create a new session in the same request as the invalidation?

yes, see below.

>request.getSession() seems to return the invalidated session.


no it doesnt, it always returns a valid session.

try the folln jsp


Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
All right, I see what my problem was. After the invalidation, I was using EL to check session attributes instead of scriptlets/expressions. Checking ${pageContext.session.id} after invalidation shows that EL still uses the invalidated session.

Thanks!
Yuriy
 
Don't get me started about those stupid light bulbs.
 
subject: creating new session after invalidation in same request