Apply @InitBinder to specific commands
Validators will not be called unless your parameter has a @Valid annotation.
By default
initBinder method will be invoked for every parameter (model attributes).
@InitBinder has an optional attribute where you can specify the specific attribute(s) to apply the method. Te value of
@InitBinder can be one of the following:
- name of a model attribute;
- name of a request parameter;
- name of the class of parameter can be used, but starting with a small letter. That's how Spring exposes unnamed attributes to the model.
No comments:
Post a Comment