Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Servlet
Can some one please help why am i getting below error? "org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:438)"
Whats wrong in my code??
Contol is not getting moved from servlet to jsp. Please correct my code.
 
Servlet Class
 
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 
		User user = new User();
		HttpSession session = request.getSession(true);
		user.setFirstName(request.getParameter("FirstName"));
		user.setPassword(request.getParameter("Password"));
		user.setConfirmPassword(request.getParameter("ConfirmPassword"));
		user.setEmail(request.getParameter("Email"));
		boolean passwordVerify = PasswordVerification.verifyPassword(user);
		boolean emailVerify= EmailIdValidation.isValidEmailId(user);
 
		if( user.getFirstName().startsWith("S"))
		{
                     if(passwordVerify )
                        {
                         if(!emailVerify)
                          {
                            response.sendRedirect("EmailValidation.jsp");
                           }
                      user.setLastName(request.getParameter("LastName"));
		   user.setContactNumber(request.getParameter("ContactNumber"));
		   user.setLandLine(request.getParameter("LandLine"));
		    response.sendRedirect("Success.jsp");		
                       }
                     else
                     {
                       response.sendRedirect("Error.jsp");
                      } 		
		}
               }
 

	
public class PasswordVerification {
 
	public static boolean verifyPassword(User user)
	{
		//String userName = user.getFirstName();
		String password = user.getPassword();
		String confirmPW = user.getConfirmPassword();
		System.out.println(password);
		System.out.println(confirmPW);
		if(password.equals(confirmPW)|| password.length()>8)
		{
			user.setValid(true);
		}
		else{ 
			System.out.println("Invalid Password");
			}
		return true;		
	}
}	
 

public class EmailIdValidation {
 
	public static boolean isValidEmailId(User user)
	{
	String email = user.getEmail();
	String emailPattern="^([A-Za-z0-9_\\-\\.])+\\@([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,4})";
		if(email==null ) 
		{   return false; 
		}
			if(!email.matches(emailPattern))
		{
			return false;
		}
		return true;
	}
}
Posted 14-Jun-13 4:16am
Edited 14-Jun-13 10:51am
(no name)117.7K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 14 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100