org.apache.struts2.interceptor

## Class StrutsConversionErrorInterceptor

- java.lang.Object
- - com.opensymphony.xwork2.interceptor.AbstractInterceptor
  - - com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
    - - com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor
      - - org.apache.struts2.interceptor.StrutsConversionErrorInterceptor

- All Implemented Interfaces:
    ConditionalInterceptor, Interceptor, Serializable

      public class StrutsConversionErrorInterceptor
      extends ConversionErrorInterceptor

  This interceptor extends `ConversionErrorInterceptor` but only adds conversion errors from the ActionContext to the field errors of the action if the field value is not null, "", or {""} (a size 1 String array with only an empty String). See `ConversionErrorInterceptor` for more information, as well as the Type Conversion documentation.

  Interceptor parameters:

  - None

  Extending the interceptor:

  There are no known extension points for this interceptor.

       <action name="someAction" class="com.examples.SomeAction">
           <interceptor-ref name="params"/>
           <interceptor-ref name="conversionError"/>
           <result name="success">good_result.ftl</result>
       </action>

  See Also:
    `ActionContext.getConversionErrors()`, `ConversionErrorInterceptor`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor

      `ORIGINAL_PROPERTY_OVERRIDE`

    - ### Fields inherited from class com.opensymphony.xwork2.interceptor.MethodFilterInterceptor

      `excludeMethods, includeMethods`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsConversionErrorInterceptor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `getOverrideExpr(ActionInvocation invocation, Object value)`
    `protected boolean` | `shouldAddError(String propertyName, Object value)` Returns `false` if the value is null, "", or {""} (array of size 1 with a blank element).

    - ### Methods inherited from class com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor

      `doIntercept, escape`

    - ### Methods inherited from class com.opensymphony.xwork2.interceptor.MethodFilterInterceptor

      `applyInterceptor, getExcludeMethodsSet, getIncludeMethodsSet, intercept, setExcludeMethods, setIncludeMethods`

    - ### Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor

      `destroy, init, setDisabled, shouldIntercept`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StrutsConversionErrorInterceptor

          public StrutsConversionErrorInterceptor()

  - ### Method Detail

    - #### getOverrideExpr

          protected Object getOverrideExpr(ActionInvocation invocation,
                                           Object value)

      Overrides:
        `getOverrideExpr` in class `ConversionErrorInterceptor`

    - #### shouldAddError

          protected boolean shouldAddError(String propertyName,
                                           Object value)

      Returns `false` if the value is null, "", or {""} (array of size 1 with a blank element). Returns `true` otherwise.
      Overrides:
        `shouldAddError` in class `ConversionErrorInterceptor`
      Parameters:
        `propertyName` - the name of the property to check.
        `value` - the value to error check.
      Returns:
        `false` if the value is null, "", or {""}, `true` otherwise.

Copyright © 2000–2022 Apache Software Foundation. All rights reserved.