Top Description Methods
org.springframework.validation

public Interface BindingErrorProcessor

Known Direct Implementers
org.springframework.validation.DefaultBindingErrorProcessor
Imports
org.springframework.beans.PropertyAccessException

Strategy for processing DataBinder's missing field errors, and for translating a PropertyAccessException to a FieldError.

The error processor is pluggable so you can treat errors differently if you want to. A default implementation is provided for typical needs.

Note

As of Spring 2.0, this interface operates on a given BindingResult, to be compatible with any binding strategy (bean property, direct field access, etc). It can still receive a BindException as argument (since a BindException implements the BindingResult interface as well) but no longer operates on it directly.

Authors
Alef Arendsen, Juergen Hoeller
Since
1.2
See Also
DataBinder#setBindingErrorProcessor, DefaultBindingErrorProcessor, BindingResult, BindException

Method Summary

Modifier and TypeMethod and Description
public void
processMissingFieldError(String
the field that was missing during binding
missingField
,
BindingResult
the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. The BindingResult object features convenience utils such as a resolveMessageCodes method to resolve an error code.
bindingResult
)

Apply the missing field error to the given BindException.

public void
processPropertyAccessException(PropertyAccessException
the PropertyAccessException to translate
ex
,
BindingResult
the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. The BindingResult object features convenience utils such as a resolveMessageCodes method to resolve an error code.
bindingResult
)

Translate the given PropertyAccessException to an appropriate error registered on the given Errors instance.

Method Detail

processMissingFieldErrorback to summary
public void processMissingFieldError(String missingField, BindingResult bindingResult)

Apply the missing field error to the given BindException.

Usually, a field error is created for a missing required field.

Parameters
missingField:String

the field that was missing during binding

bindingResult:BindingResult

the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. The BindingResult object features convenience utils such as a resolveMessageCodes method to resolve an error code.

See Also
BeanPropertyBindingResult#addError, BeanPropertyBindingResult#resolveMessageCodes
processPropertyAccessExceptionback to summary
public void processPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult)

Translate the given PropertyAccessException to an appropriate error registered on the given Errors instance.

Note that two error types are available: FieldError and ObjectError. Usually, field errors are created, but in certain situations one might want to create a global ObjectError instead.

Parameters
ex:PropertyAccessException

the PropertyAccessException to translate

bindingResult:BindingResult

the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. The BindingResult object features convenience utils such as a resolveMessageCodes method to resolve an error code.

See Also
Errors, FieldError, ObjectError, MessageCodesResolver, BeanPropertyBindingResult#addError, BeanPropertyBindingResult#resolveMessageCodes