how to invalidate a session
843785Aug 15 2008 — edited Aug 19 2008Hi all,
i am creating a web application in eclipse SDK...when a user logins , he is assigned a session as
HttpSession session = req.getSession(true);
session.setAttribute("username", user);
and then user is redirected to openings.jsp page
my openings.jsp page contains.
if (session.getAttribute("username") == null){
response.sendRedirect("logout.jsp");
}
and my logout code is:
session.removeAttribute("username");
session.invalidate();
response.sendRedirect("Login.html");
my problem is this whenever i write http://localhost:8081/jobs/openings.jsp
it is redirected to that openings page with a previous username...
i want that whenever i write http://localhost:8081/jobs/openings.jsp i should be redirected to login page..
how this can be done...??
Thanks in advance..