Hi, I'm using Spring 3.0. I have a model with attributes like ...
and I also created a custom validator because I need to do some more advanced validation. I validate in my controller like so ...Code:public class RegistrationForm { @NotBlank private String firstName; @NotBlank private String lastName; ... }
But even if I submit a blank form, nothing gets printed out in my "<form:errors />" tag. Is this because I have a custom validator ? Does anyone know how to get my annotations to be validated?Code:@RequestMapping(method = RequestMethod.POST) public String onSubmit(HttpServletRequest request, HttpServletResponse response, Model model, @ModelAttribute("registrationForm") RegistrationForm form, BindingResult result) throws SQLException, IOException { String viewName = "/account/register"; // set custom Validation by user registrationValidation.validate(form, result); if (!result.hasErrors()) { ... return viewName; }
Thanks, - Dave


Reply With Quote