I pass a scoped object from one JSP #1 to JSP #2 in a session.
In JSP #1, I did:
In JSP #2, I did:
Immediately after I output the value, I want to remove the object from the session. I have two questions: 1. which one of the following should I do:
or
or
2. Do I have to invalidate the session; i.e. session.invalidate(); after all the objects in the session are removed?
[ July 06, 2004: Message edited by: JiaPei Jen ] [ July 06, 2004: Message edited by: JiaPei Jen ]
Atul Prabhu
Ranch Hand
Joined: Dec 17, 2002
Posts: 60
posted
0
Hi,
You would have to use session.removeAttribute( "cr" ), session.removeAttribute( "author" ) cannot be used because "author" is available in page scope. session.removeAttribute( "reciever" ) cannot be used because "reciver" would be in the request scope after the form is submitted.
Why would u have to use session.invalidate()
Hope this solves ur problem.
Regards Atul
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
1
posted
0
2. Do I have to invalidate the session; i.e. session.invalidate(); after all the objects in the session are removed?
A single call to session.invalidate() will automatically remove all attached references. Of course you won't be able to use that session at all after that call - you will get an IllegalStateException. Bill