samedi 28 février 2015

spring 4 not validate


@RequestMapping(value="/app/home/refernece",method=RequestMethod.POST)
public String processReference(HttpServletRequest request, @ModelAttribute("refernceForm") @Validated @Valid ReferenceForm referenceForm, BindingResult bindingResult, Model model){

if(!bindingResult.hasErrors()){
boolean emailExists = customerservice.customerWithEmailExists(referenceForm.getRefernceMail());
if (!emailExists) {
bindingResult.rejectValue("refernceMail", "registrationform.valid.email.exists");
}

}
System.out.print(referenceForm.getRefernceName());
if (bindingResult.hasErrors()) {
//logger.log(Level.DEBUG, "Form Errors.");
//model.addAttribute("BindingResult",bindingResult);
//model.addAttribute("refernceForm", new ReferenceForm());
return "view/app/refernce";
}
return "redirect:/home/systemschein";

}



  • This my handler method.

  • I add 2 validator to this controller but its not validating?


Aucun commentaire:

Enregistrer un commentaire