getErrors method.
Note that BindTag does not use this class to avoid unnecessary creation of ObjectError instances. It just escapes the messages and values that get copied into the respective BindStatus instance.
org.springframework.web.servlet.support.RequestContext#getErrors , org.springframework.web.servlet.tags.BindTag
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addAllErrors(Errors
the errors)Errors instance to merge inOverrides default org. Add all errors from the given |
| private <T extends ObjectError> T | |
| private <T extends ObjectError> List | |
| public List | getAllErrors()
Overrides default org. Get all errors, both global and field ones. |
| public int | getErrorCount()
Overrides default org. Determine the total number of errors. |
| public FieldError | getFieldError()
Overrides default org. Get the first error associated with a field, if any. |
| public FieldError | getFieldError(String
the field name field)Overrides default org. Get the first error associated with the given field, if any. |
| public int | getFieldErrorCount()
Overrides default org. Determine the number of errors associated with a field. |
| public int | getFieldErrorCount(String
the field name field)Overrides default org. Determine the number of errors associated with the given field. |
| public List | getFieldErrors()
Implements org. Get all errors associated with a field. |
| public List | getFieldErrors(String
the field name field)Overrides default org. Get all errors associated with the given field. |
| public Class | getFieldType(String
the field name field)Overrides default org. Determine the type of the given field, as far as possible. |
| public Object | getFieldValue(String
the field name field)Implements org. Return the current value of the given field, either the current bean property value or a rejected update from the last binding. |
| public ObjectError | getGlobalError()
Overrides default org. Get the first global error, if any. |
| public int | getGlobalErrorCount()
Overrides default org. Determine the number of global errors. |
| public List | getGlobalErrors()
Implements org. Get all global errors. |
| public String | getNestedPath()
Overrides default org. Return the current nested path of this |
| public String | getObjectName()
Implements org. Return the name of the bound root object. |
| public Errors | |
| public boolean | hasErrors()
Overrides default org. Determine if there were any errors. |
| public boolean | hasFieldErrors()
Overrides default org. Determine if there were any errors associated with a field. |
| public boolean | hasFieldErrors(String
the field name field)Overrides default org. Determine if there were any errors associated with the given field. |
| public boolean | hasGlobalErrors()
Overrides default org. Determine if there were any global errors. |
| public void | popNestedPath()
Overrides default org. Pop the former nested path from the nested path stack. |
| public void | pushNestedPath(String
the sub path to push onto the nested path stack subPath)Overrides default org. Push the given sub path onto the nested path stack. |
| public void | reject(String
error code, interpretable as a message key errorCode)Overrides default org. Register a global error for the entire target object, using the given error description. |
| public void | reject(String
error code, interpretable as a message key errorCode, String fallback default message defaultMessage)Overrides default org. Register a global error for the entire target object, using the given error description. |
| public void | reject(String
error code, interpretable as a message key errorCode, Object[] error arguments, for argument binding via MessageFormat
(can be errorArgs, String null)fallback default message defaultMessage)Implements org. Register a global error for the entire target object, using the given error description. |
| public void | rejectValue(String
the field name (may be field, String null or empty String)error code, interpretable as a message key errorCode)Overrides default org. Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description. |
| public void | rejectValue(String
the field name (may be field, String null or empty String)error code, interpretable as a message key errorCode, String fallback default message defaultMessage)Overrides default org. Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description. |
| public void | rejectValue(String
the field name (may be field, String null or empty String)error code, interpretable as a message key errorCode, Object[] error arguments, for argument binding via MessageFormat
(can be errorArgs, String null)fallback default message defaultMessage)Implements org. Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description. |
| public void | setNestedPath(String
nested path within this object,
e.g. "address" (defaults to "", nestedPath)null is also acceptable).
Can end with a dot: both "address" and "address." are valid.Overrides default org. Allow context to be changed so that standard validators can validate subtrees. |
| source | back to summary |
|---|---|
| private final Errors source | |
| EscapedErrors | back to summary |
|---|---|
| public EscapedErrors(Errors source) Create a new EscapedErrors instance for the given source instance. | |
| addAllErrors | back to summary |
|---|---|
| public void addAllErrors(Errors errors) Overrides default org. Doc from org. Add all errors from the given This is a convenience method to avoid repeated Note that the passed-in The default implementation throws | |
| escapeObjectError | back to summary |
|---|---|
private <T extends ObjectError> T escapeObjectError(T source)
| |
| escapeObjectErrors | back to summary |
|---|---|
| private <T extends ObjectError> List | |
| getAllErrors | back to summary |
|---|---|
| public List Overrides default org. Doc from org. Get all errors, both global and field ones.
| |
| getErrorCount | back to summary |
|---|---|
| public int getErrorCount() Overrides default org. Doc from org. Determine the total number of errors.
| |
| getFieldError | back to summary |
|---|---|
| public FieldError getFieldError() Overrides default org. Doc from org. Get the first error associated with a field, if any.
| |
| getFieldError | back to summary |
|---|---|
| public FieldError getFieldError(String field) Overrides default org. Doc from org. Get the first error associated with the given field, if any.
| |
| getFieldErrorCount | back to summary |
|---|---|
| public int getFieldErrorCount() Overrides default org. Doc from org. Determine the number of errors associated with a field.
| |
| getFieldErrorCount | back to summary |
|---|---|
| public int getFieldErrorCount(String field) Overrides default org. Doc from org. Determine the number of errors associated with the given field. | |
| getFieldErrors | back to summary |
|---|---|
| public List Implements org. Doc from org. Get all errors associated with a field.
| |
| getFieldErrors | back to summary |
|---|---|
| public List Overrides default org. Doc from org. Get all errors associated with the given field. Implementations may support not only full field names like "address.street" but also pattern matches like "address.*".
| |
| getFieldType | back to summary |
|---|---|
| public Class Overrides default org. Doc from org. Determine the type of the given field, as far as possible. Implementations should be able to determine the type even
when the field value is | |
| getFieldValue | back to summary |
|---|---|
| public Object getFieldValue(String field) Implements org. Doc from org. Return the current value of the given field, either the current bean property value or a rejected update from the last binding. Allows for convenient access to user-specified field values, even if there were type mismatches. | |
| getGlobalError | back to summary |
|---|---|
| public ObjectError getGlobalError() Overrides default org. Doc from org. Get the first global error, if any.
| |
| getGlobalErrorCount | back to summary |
|---|---|
| public int getGlobalErrorCount() Overrides default org. Doc from org. Determine the number of global errors.
| |
| getGlobalErrors | back to summary |
|---|---|
| public List Implements org. Doc from org. Get all global errors.
| |
| getNestedPath | back to summary |
|---|---|
| public String getNestedPath() Overrides default org. Doc from org. Return the current nested path of this Returns a nested path with a dot, i.e. "address.", for easy building of concatenated paths. Default is an empty String.
| |
| getObjectName | back to summary |
|---|---|
| public String getObjectName() Implements org. Doc from org. Return the name of the bound root object.
| |
| getSource | back to summary |
|---|---|
| public Errors getSource() | |
| hasErrors | back to summary |
|---|---|
| public boolean hasErrors() Overrides default org. Doc from org. Determine if there were any errors.
| |
| hasFieldErrors | back to summary |
|---|---|
| public boolean hasFieldErrors() Overrides default org. Doc from org. Determine if there were any errors associated with a field.
| |
| hasFieldErrors | back to summary |
|---|---|
| public boolean hasFieldErrors(String field) Overrides default org. Doc from org. Determine if there were any errors associated with the given field. | |
| hasGlobalErrors | back to summary |
|---|---|
| public boolean hasGlobalErrors() Overrides default org. Doc from org. Determine if there were any global errors.
| |
| popNestedPath | back to summary |
|---|---|
| public void popNestedPath() throws IllegalStateException Overrides default org. Doc from org. Pop the former nested path from the nested path stack.
| |
| pushNestedPath | back to summary |
|---|---|
| public void pushNestedPath(String subPath) Overrides default org. Doc from org. Push the given sub path onto the nested path stack. A Using the nested path stack allows to set temporary nested paths for subobjects without having to worry about a temporary path holder. For example: current path "spouse.", pushNestedPath("child") → result path "spouse.child."; popNestedPath() → "spouse." again. The default implementation throws | |
| reject | back to summary |
|---|---|
| public void reject(String errorCode) Overrides default org. Doc from org. Register a global error for the entire target object, using the given error description. | |
| reject | back to summary |
|---|---|
| public void reject(String errorCode, String defaultMessage) Overrides default org. Doc from org. Register a global error for the entire target object, using the given error description. | |
| reject | back to summary |
|---|---|
| public void reject(String errorCode, Object[] errorArgs, String defaultMessage) Implements org. Doc from org. Register a global error for the entire target object, using the given error description. | |
| rejectValue | back to summary |
|---|---|
| public void rejectValue(String field, String errorCode) Overrides default org. Doc from org. Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description. The field name may be | |
| rejectValue | back to summary |
|---|---|
| public void rejectValue(String field, String errorCode, String defaultMessage) Overrides default org. Doc from org. Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description. The field name may be | |
| rejectValue | back to summary |
|---|---|
| public void rejectValue(String field, String errorCode, Object[] errorArgs, String defaultMessage) Implements org. Doc from org. Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description. The field name may be | |
| setNestedPath | back to summary |
|---|---|
| public void setNestedPath(String nestedPath) Overrides default org. Doc from org. Allow context to be changed so that standard validators can validate subtrees. Reject calls prepend the given path to the field names. For example, an address validator could validate the subobject "address" of a customer object. The default implementation throws | |