0

I have the following code

 Errors errors = new MapBindingResult(new HashMap(), "person");

Why do we specify "person" as the second argument, when is it used?

Rustam Issabekov
  • 3,279
  • 6
  • 24
  • 31

1 Answers1

0

Its basically to pinpoint the error context. It tells the client or the end user that the errors are related to which entity , in your case person.

If you will see the default messages that spring will put for validations, they will be of the form

person.required 

person.invalid 

or something similar

They act as kind of namespaces

hellojava
  • 4,904
  • 9
  • 30
  • 38