jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes invalidate a session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "invalidate a session" Watch "invalidate a session" New topic

invalidate a session

grace chow

Joined: Oct 25, 2004
Posts: 13
Do you know how to invalidate a user by using a session id in servlet?
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

You neednt have a session id to invalidate a session. Get a handle to the session using request.getSession(false) and on the session object returned, call the invalidate() method.

Poobhathy Kannan
Ranch Hand

Joined: May 26, 2004
Posts: 94
you can not invalidate user using session id.you can remove user from session..
HttpSession session = request.getSession();

or you have to invalidate session..

It is sorta covered in the JavaRanch Style Guide.
subject: invalidate a session
Similar Threads
Calling invalidate() on the session....
Ending a session?
Authentication with JDBCRealm - getUser() ?
How to invalidate session on the basis of session ID in servlet
How to delete a session by knowing the session id