Class EscapedErrors

java.lang.Object
org.springframework.web.bind.EscapedErrors
All Implemented Interfaces:
org.springframework.validation.Errors

public class EscapedErrors extends Object implements org.springframework.validation.Errors
Errors wrapper that adds automatic HTML escaping to the wrapped instance, for convenient usage in HTML views. Can be retrieved easily via RequestContext's 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.

Since:
01.03.2003
Author:
Juergen Hoeller
See Also:
  • org.springframework.web.servlet.support.RequestContext#getErrors
  • org.springframework.web.servlet.tags.BindTag
  • Constructor Details

    • EscapedErrors

      public EscapedErrors(org.springframework.validation.Errors source)
      Create a new EscapedErrors instance for the given source instance.
  • Method Details

    • getSource

      public org.springframework.validation.Errors getSource()
    • getObjectName

      public String getObjectName()
      Specified by:
      getObjectName in interface org.springframework.validation.Errors
    • setNestedPath

      public void setNestedPath(String nestedPath)
      Specified by:
      setNestedPath in interface org.springframework.validation.Errors
    • getNestedPath

      public String getNestedPath()
      Specified by:
      getNestedPath in interface org.springframework.validation.Errors
    • pushNestedPath

      public void pushNestedPath(String subPath)
      Specified by:
      pushNestedPath in interface org.springframework.validation.Errors
    • popNestedPath

      public void popNestedPath() throws IllegalStateException
      Specified by:
      popNestedPath in interface org.springframework.validation.Errors
      Throws:
      IllegalStateException
    • reject

      public void reject(String errorCode)
      Specified by:
      reject in interface org.springframework.validation.Errors
    • reject

      public void reject(String errorCode, String defaultMessage)
      Specified by:
      reject in interface org.springframework.validation.Errors
    • reject

      public void reject(String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage)
      Specified by:
      reject in interface org.springframework.validation.Errors
    • rejectValue

      public void rejectValue(@Nullable String field, String errorCode)
      Specified by:
      rejectValue in interface org.springframework.validation.Errors
    • rejectValue

      public void rejectValue(@Nullable String field, String errorCode, String defaultMessage)
      Specified by:
      rejectValue in interface org.springframework.validation.Errors
    • rejectValue

      public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage)
      Specified by:
      rejectValue in interface org.springframework.validation.Errors
    • addAllErrors

      public void addAllErrors(org.springframework.validation.Errors errors)
      Specified by:
      addAllErrors in interface org.springframework.validation.Errors
    • hasErrors

      public boolean hasErrors()
      Specified by:
      hasErrors in interface org.springframework.validation.Errors
    • getErrorCount

      public int getErrorCount()
      Specified by:
      getErrorCount in interface org.springframework.validation.Errors
    • getAllErrors

      public List<org.springframework.validation.ObjectError> getAllErrors()
      Specified by:
      getAllErrors in interface org.springframework.validation.Errors
    • hasGlobalErrors

      public boolean hasGlobalErrors()
      Specified by:
      hasGlobalErrors in interface org.springframework.validation.Errors
    • getGlobalErrorCount

      public int getGlobalErrorCount()
      Specified by:
      getGlobalErrorCount in interface org.springframework.validation.Errors
    • getGlobalErrors

      public List<org.springframework.validation.ObjectError> getGlobalErrors()
      Specified by:
      getGlobalErrors in interface org.springframework.validation.Errors
    • getGlobalError

      @Nullable public org.springframework.validation.ObjectError getGlobalError()
      Specified by:
      getGlobalError in interface org.springframework.validation.Errors
    • hasFieldErrors

      public boolean hasFieldErrors()
      Specified by:
      hasFieldErrors in interface org.springframework.validation.Errors
    • getFieldErrorCount

      public int getFieldErrorCount()
      Specified by:
      getFieldErrorCount in interface org.springframework.validation.Errors
    • getFieldErrors

      public List<org.springframework.validation.FieldError> getFieldErrors()
      Specified by:
      getFieldErrors in interface org.springframework.validation.Errors
    • getFieldError

      @Nullable public org.springframework.validation.FieldError getFieldError()
      Specified by:
      getFieldError in interface org.springframework.validation.Errors
    • hasFieldErrors

      public boolean hasFieldErrors(String field)
      Specified by:
      hasFieldErrors in interface org.springframework.validation.Errors
    • getFieldErrorCount

      public int getFieldErrorCount(String field)
      Specified by:
      getFieldErrorCount in interface org.springframework.validation.Errors
    • getFieldErrors

      public List<org.springframework.validation.FieldError> getFieldErrors(String field)
      Specified by:
      getFieldErrors in interface org.springframework.validation.Errors
    • getFieldError

      @Nullable public org.springframework.validation.FieldError getFieldError(String field)
      Specified by:
      getFieldError in interface org.springframework.validation.Errors
    • getFieldValue

      @Nullable public Object getFieldValue(String field)
      Specified by:
      getFieldValue in interface org.springframework.validation.Errors
    • getFieldType

      @Nullable public Class<?> getFieldType(String field)
      Specified by:
      getFieldType in interface org.springframework.validation.Errors