Reputation: 1398
I used this format despite warnings:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<html>");
//code
out.println("</html>");
out.close();
}
How do I change the value of a variable when a button is pressed?
EX:
out.println("<button><a href = 'home' action = "isLoggedIn = false">Logout</a></a>");
This would be run from the homepage and basically refresh the page except the user would be logged out. What is the proper way of doing so?
Upvotes: 0
Views: 69
Reputation: 786
After user login,you need to create session and Once the user click the Logout Button,you need to invalidate by using session.invalidate()
and then redirect to home page without any session.
Follow the below for reference
This one use only servlets.I think this will help you :)
Upvotes: 1