| org.springframework.validation.BindingResult
Field Summary | |
String | MODEL_KEY_PREFIX Prefix for the name of the BindingResult instance in a model,
followed by the object name. |
Method Summary | |
void | addError(ObjectError error) Add a custom
ObjectError or
FieldError to the errors list. | Map | getModel() Return a model Map for the obtained state, exposing a BindingResult
instance as '
BindingResult.MODEL_KEY_PREFIX MODEL_KEY_PREFIX + objectName'
and the object itself as 'objectName'.
Note that the Map is constructed every time you're calling this method.
Adding things to the map and then re-calling this method will not work.
The attributes in the model Map returned by this method are usually
included in the
org.springframework.web.servlet.ModelAndView for a form view that uses Spring's bind tag in a JSP,
which needs access to the BindingResult instance. | PropertyEditorRegistry | getPropertyEditorRegistry() Return the underlying PropertyEditorRegistry. | String[] | getSuppressedFields() Return the list of fields that were suppressed during the bind process. | Object | getTarget() Return the wrapped target object, which may be a bean, an object with
public fields, a Map - depending on the concrete binding strategy. | void | recordSuppressedField(String fieldName) Mark the specified disallowed field as suppressed. | String[] | resolveMessageCodes(String errorCode, String field) Resolve the given error code into message codes for the given field. |
MODEL_KEY_PREFIX | String MODEL_KEY_PREFIX(Code) | | Prefix for the name of the BindingResult instance in a model,
followed by the object name.
|
getModel | Map getModel()(Code) | | Return a model Map for the obtained state, exposing a BindingResult
instance as '
BindingResult.MODEL_KEY_PREFIX MODEL_KEY_PREFIX + objectName'
and the object itself as 'objectName'.
Note that the Map is constructed every time you're calling this method.
Adding things to the map and then re-calling this method will not work.
The attributes in the model Map returned by this method are usually
included in the
org.springframework.web.servlet.ModelAndView for a form view that uses Spring's bind tag in a JSP,
which needs access to the BindingResult instance. Spring's pre-built
form controllers will do this for you when rendering a form view.
When building the ModelAndView instance yourself, you need to include
the attributes from the model Map returned by this method.
See Also: BindingResult.getObjectName() See Also: BindingResult.MODEL_KEY_PREFIX See Also: org.springframework.web.servlet.ModelAndView See Also: org.springframework.web.servlet.tags.BindTag See Also: org.springframework.web.servlet.mvc.SimpleFormController |
getSuppressedFields | String[] getSuppressedFields()(Code) | | Return the list of fields that were suppressed during the bind process.
Can be used to determine whether any field values were targeting
disallowed fields.
See Also: DataBinder.setAllowedFields |
getTarget | Object getTarget()(Code) | | Return the wrapped target object, which may be a bean, an object with
public fields, a Map - depending on the concrete binding strategy.
|
recordSuppressedField | void recordSuppressedField(String fieldName)(Code) | | Mark the specified disallowed field as suppressed.
The data binder invokes this for each field value that was
detected to target a disallowed field.
See Also: DataBinder.setAllowedFields |
resolveMessageCodes | String[] resolveMessageCodes(String errorCode, String field)(Code) | | Resolve the given error code into message codes for the given field.
Calls the configured
MessageCodesResolver with appropriate parameters.
Parameters: errorCode - the error code to resolve into message codes Parameters: field - the field to resolve message codes for the resolved message codes |
|
|