Hi i designed a html page with input fields for username and password, on clicking the logon button the javascript calls a
servlet which checks wether the credentials provided are proper or not and then redirect the page to another
jsp, but i am facing a problem in this redirect.
[code]
if(password.equals(pword))
{
request.getSession().setAttribute("UserName",username);
response.sendRedirect("src/jsp/second.jsp");
}
else
{
System.out.println("inside else");
out.println("<html><script langauge=\"javascript\">function raiseexception(){alert(\"The Username and the Password did not match please ensure that you enter the correct username and password \");}</script> <body onloud=\"raiseexception();\"></body></html>");
response.sendRedirect("src/jsp/home.html");
}
The problem is when username and password are matched it redirects to the second.jsp page but when the username and password do not match it does not display the alert saying the username and password did not match it just redirects to the same page home.html, I want the alert message along with the redirect can anybody help me in this.
Also when user log's in the session is to be maintained through out the application, can anybody suggest me how to do that..
[ September 23, 2008: Message edited by: ruquia tabassum ]