Reputation: 766
Using servlet 2.3 is there a way to log a user out when he has signed in using form authentication. I know servlet 3.0 has this feature of logging out. What should servlet 2.3 users do for logging out ?
Upvotes: 2
Views: 1542
Reputation: 15446
Look here Regarding Logout. It also explains the difference between
Servlet 3.0 HttpServletRequest.logout()
and
session.invalidate() method.
Upvotes: 1
Reputation: 1108712
Just invalidate the session.
request.getSession().invalidate();
Don't forget to send a redirect afterwards.
response.sendRedirect(request.getContextPath() + "/login.jsp");
Upvotes: 3