|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BindingResult
General interface that represents binding results. Extends the Errors interface for error registration capabilities and adds binding-specific functionality.
Serves as result holder for DataBinder. Implementations can also be used directly, for example to invoke a Validator on it.
DataBinder.getBindingResult(),
Errors,
Validator,
BeanPropertyBindingResult,
MapBindingResult| Field Summary | |
|---|---|
static String |
MODEL_KEY_PREFIX
Prefix for the name of the BindingResult instance in a model, followed by the object name. |
| Fields inherited from interface org.springframework.validation.Errors |
|---|
NESTED_PATH_SEPARATOR |
| Method Summary | |
|---|---|
void |
addError(ObjectError error)
Add an ObjectError or FieldError to the errors list. |
Map |
getModel()
Return a model Map for the obtained state, exposing a BindingResult instance as ' MODEL_KEY_PREFIX + objectName'
and the object itself as 'objectName'. |
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. |
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. |
| Methods inherited from interface org.springframework.validation.Errors |
|---|
addAllErrors, getAllErrors, getErrorCount, getFieldError, getFieldError, getFieldErrorCount, getFieldErrorCount, getFieldErrors, getFieldErrors, getFieldType, getFieldValue, getGlobalError, getGlobalErrorCount, getGlobalErrors, getNestedPath, getObjectName, hasErrors, hasFieldErrors, hasFieldErrors, hasGlobalErrors, popNestedPath, pushNestedPath, reject, reject, reject, rejectValue, rejectValue, rejectValue, setNestedPath |
| Field Detail |
|---|
static final String MODEL_KEY_PREFIX
| Method Detail |
|---|
Object getTarget()
Map getModel()
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 ModelAndView for a form view that uses Spring's bind tag, 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 yourself, you need to include the attributes from the model Map returned by this method yourself.
Errors.getObjectName(),
MODEL_KEY_PREFIX,
ModelAndView,
BindTag,
SimpleFormControllerPropertyEditorRegistry getPropertyEditorRegistry()
UnsupportedOperationException - if the BindingResult
does not support a PropertyEditorRegistryvoid recordSuppressedField(String fieldName)
The data binder invokes this for each field value that was detected to target a disallowed field.
DataBinder.setAllowedFields(java.lang.String[])String[] getSuppressedFields()
Can be used to determine whether any field values were targetting disallowed fields.
DataBinder.setAllowedFields(java.lang.String[])void addError(ObjectError error)
Intended to be used by subclasses like DataBinder, or by cooperating strategies like a BindingErrorProcessor.
ObjectError,
FieldError,
DataBinder,
BindingErrorProcessor
String[] resolveMessageCodes(String errorCode,
String field)
errorCode - the error code to resolve into message codesfield - the field to resolve message codes for
|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||