I need to end the session automatically when the user is inactive for some particular time say for 10 minutes. We have a method in
HttpSession session=request.getSession();
session.setAttribute("User", au);
session.setAttribute("name", firstname);
response.sendRedirect("doLogin.jsp");
session.setMaxInterval();
but this will end the session even if the user is active for 10 minutes. How can I end the session when the user closes the browser?