I have a form, but when I submit it, my initbinder doesn't intercept my post request. This is my initbinder:
@InitBinder(value="confermaDto")
protected void initBinderDto(final WebDataBinder binder, final Locale locale) {
binder.registerCustomEditor(MyClass.class, myClassEditor);
}
And this is my method to intercept the post:
@RequestMapping(value="confermaDati", method = RequestMethod.POST)
public String confermaDati(@Valid final ConfermaDatiAttrezzaturaDto confermaDto,
final BindingResult bindingResult, final Model uiModel, final HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("message", "Errore Salvataggio");
uiModel.addAttribute("dto", confermaDto);
}
uiModel.asMap().clear();
return "redirect:/";
}
I think, that it should work because the value in initbinder, and the name of my model attribure are equal. So why don't it work??
Thank you