Use a session object in the JSP to end a session.
session.invalidate();
UPDATE
Create a separate header page and select the exit option when the user is logged in. After clicking on the sign, do what I told you.
After the session is destroyed, redirect the user to the home page.
response.sendRedirect("home.jsp");
source
share