Implementing Logout functionality in a form based authentication in J2EE website is straight forward. The session needs to be invalidated by calling request.getSession().invalidate() method. Thus in a simple servlet following code will be the code for logout:
This is simple way for implementing logout. There is also another, easier, way to logout the user when using WebSphere Application Server. All you have to do is have a form which gets submit to action ibm_security_logout.
Click here to logout:
In the above example, the hidden field “logoutExitPage” is contains the value of the page where the application redirects after logout.