// Order of BindingResult matters (it must be just after ModelAttribute) @RequestMapping(value = "/registration", method = RequestMethod.POST) public String registrationPost( @Valid @ModelAttribute("userForm") User userReg, BindingResult result, Model model, HttpServletRequest request) { ValidatorUserPassEmail userValidator = new ValidatorUserPassEmail(); userValidator.validate(userReg, result); if (result.hasErrors()) { logger.info("Registration Error"); return "registration"; } // User userRetrived = userReg.retrieve logger.info("Registration Post"); System.out.println("1 " + userReg.getEmail()); System.out.println("2 " + userReg.getFirstname()); System.out.println("3 " + userReg.getLastname()); System.out.println("4 " + userReg.getPassword()); System.out.println("5 " + userReg.getDateOfBirth()); String encrypted = PassHasher.encryptSHA512(userReg.getPassword()); userReg.setPassword(encrypted); logger.info("Password Encrypted " + encrypted); UserDao userDao = (UserDao) context.getBean("userDao"); if (userDao.exists(userReg.getEmail())) { model.addAttribute("userexerror", "true"); return "registration"; } else { userDao.create(userReg); return "redirect:/"; } }