close

Filter

loading table of contents...

Content Application Developer Manual / Version 2307

Table Of Contents
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
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.