close

Filter

loading table of contents...

Content Application Developer Manual / Version 2010

Table Of Contents
4.3.6.3.3 Error handling in the handler method

When errors during binding should be handled within a handler method, an optional BindingResult method parameter must be added to the handler method to be able to access any validator errors added during binding.

Note

Note

The method parameter BindingResult MUST follow the validated parameter immediately!

public ModelAndView handleFormSubmit(
          @ModelAttribute("nameOfForm") @Valid MyForm form,
          BindingResult formBindingResult,
          ...)

BindingResult#hasErrors() can be used to check for errors in the handler method.

BindingResult#reject() can be used to add errors (as a result of a business transaction, for example) in the handler method.

Search Results

Table Of Contents