File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Session doesn't  invalidate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session doesn Watch "Session doesn New topic
Author

Session doesn't invalidate

amit kr
Greenhorn

Joined: Aug 22, 2001
Posts: 4
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();

Amit kr
vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
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 !


SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
amit kr
Greenhorn

Joined: Aug 22, 2001
Posts: 4
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

Joined: Mar 22, 2000
Posts: 12955
    
    5
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session doesn't invalidate