@RequestMapping(method = RequestMethod.POST) public ModelAndView onSubmit(@ModelAttribute("command") About command, BindingResult result) { if (!StringUtils.hasText(command.getEmail())) { result.rejectValue("email", "email.required"); } if (command.getComments().length() > 32) { result.rejectValue("email", "email.length.exceeded"); } if (!StringUtils.hasText(command.getComments())) { result.rejectValue("comments", "comment.required"); } if (command.getComments().length() > 255) { result.rejectValue("comments", "comment.length.exceeded"); } if (result.hasErrors()) { return new ModelAndView("common/about", "command", command); } else { dao.insertComments(command); return new ModelAndView("common/aboutSuccess"); } }