| Author |
Session
|
Nabila Mohammad
Ranch Hand
Joined: Nov 05, 2007
Posts: 661
|
|
This is a simple program I wrote to test whether the session is new or old.
What I cant get is , after I call session.invalidate() , how are the lines after session.invalidate being run.
like printing out the values of attribute.
Also , the session object is the same .
|
The future belongs to those who believe in the beauty of their dreams.Dream BIG!
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
You've already taken out the attributes out from the session before invalidating it. Try calling session.getAttribute after invalidating it, you'll get an IllegalStateException...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Nabila Mohammad
Ranch Hand
Joined: Nov 05, 2007
Posts: 661
|
|
Invoking getAttribute() after invalidate() will definitely cause a runtime exception ,
But doesn't the attrbute value get destroyed when the session is invalidated??
|
 |
priya rishi
Ranch Hand
Joined: Oct 26, 2008
Posts: 119
|
|
But doesn't the attrbute value get destroyed when the session is invalidated??
you are storing them in the String Objects , nothing happens to the String objects.
Only the attributes which belonged to the session is no longer available.
|
SCJP 5 , SCWCD 5
|
 |
Nabila Mohammad
Ranch Hand
Joined: Nov 05, 2007
Posts: 661
|
|
|
That explains it. Thanks Priya !!!
|
 |
 |
|
|
subject: Session
|
|
|