At the beginning of each page , place this small code, or include it in a common file
HttpSession session =request.getSession(true);
if (session.getValue("username") == null) {
response.sendRedirect (response.encodeRedirectUrl("LoginPage.jsp?currentURL=productdata.jsp"));
}
else
{
// Go ahead and show the page
}
In LoginPage.jsp once the user has provided the correct logon credentials:
session.putValue("username",currentuser);
response.sendRedirect(response.encodeRedirectUrl(request.getParameter("currentURL")));
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment