I can successfully validate my form and even return the errors. My problems started when my view had a few selects that needed to be populated with the data coming from the controller.
When i do model.addAttribute(...) it stops passing the errors to the view:
public String registerSubmit(@Valid @ModelAttribute("jconcorrente") Jconcorrentes concorrente, BindingResult result, HttpServletRequest request, Model model){ if(result.hasErrors()) { model.addAttribute("listJdistrito", this.jdistritoService.listJdistrito()); model.addAttribute("listJtipocodiden", this.jtipodocidenService.listJtipodociden()); model.addAttribute("jconcorrente", new Jconcorrentes()); return "register"; }
So my question is how can i pass the data without affecting the validation errors?