// Get the session object or create one if it does not exist
HttpSession session = req.getSession(true);
if (session.isNew()) {
res.sendRedirect(loginURL);
session.invalidate();
} else {
res.sendRedirect(anotherURL);
}
-ernie
Sivagama Sundari wrote:
Hi folks,
I have a login servlet that takes the user id and password of the user and
stores it in the session.For further requests Iam checking if the user's
session is already created.If yes Iam allowing the user to access the
requested page,if not Iam taking the user to the login page.
Iam using HttpSession.getSession(true) in the login servlet and
HttpSession.getSession(false) in all the other servlets.The problem is that
HttpSession.getSession(false) is returning null even if the user has already
logged in.The code in other servlets is something like this:HttpSession session = req.getSession(false);
if(session == null)
res.sendRedirect(loginURL);Is it a problem with sendRedirect?
I know this is a common problem but I havent found a solution for this
anywhere.Please help.TIA
Sundari___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
