Logout through servlet.
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class Logout extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException
{
PrintWriter pw=res.getWriter();
res.setContentType("text/html");
HttpSession ses=req.getSession(false);
ses.invalidate();
RequestDispatcher rd=req.getRequestDispatcher("index.html");
rd.forward(req,res);
}
}