Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

invalidate a session

 
grace chow
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear,
Do you know how to invalidate a user by using a session id in servlet?
regards,
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

ram.
 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can not invalidate user using session id.you can remove user from session..
HttpSession session = request.getSession();
session.removeAttribute("user");

or you have to invalidate session..
session.invalidate();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic