• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session doesn't invalidate

 
amit kr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using session object of JSP.
To maintain id of user throughout the application,i keep the user id in a Vector and then i put it in the session.
Vector v1=new Vector();
v1=(Vector)session.getValue("user");
login=(String)v1.elementAt(1);
This is working fine.
The problem i am facing is session doesn't invalidate through the following code:
session.invalidate();
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well its better if u could create another page (logout.jsp) and in there include this session.invalidate () to be more clear in ur jsp page have a button for logout and then when user cliks on it then he should be directed to this page which does this invalidation!!! thats the best way , else if u include this session.invalidate in ur normal working pages then whole of session will be invalidated beware !
 
amit kr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vivek,
Infact what ever you suggested i am doing the same.
But still i face this problem.
I need to know is there any other way to invalidate session.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel sure that session.invalidate() works - if you are having a problem, the cause lies elsewhere. Have you checked the contents of the session to make sure you have the right one before invalidating?
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic