f-angi
2/24/2016 - 8:15 AM

Spring validation: how to add an error to a BindingResult

Spring validation: how to add an error to a BindingResult

bindingResult.reject("NotFound.denuncia.polizza", new Object[] {
    denuncia.getNumeroPolizza()
}, "Polizza non trovata");

// may be necessary if returning without setting a renderParameter to specify the view
model.addAttribute("errors", bindingResult);
return;