Class ConversionErrorInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
- Direct Known Subclasses:
- StrutsConversionErrorInterceptor
 This interceptor adds any error found in the ActionContext's conversionErrors map as a field error (provided
 that the action implements ValidationAware). In addition, any field that contains a validation error has its
 original value saved such that any subsequent requests for that value return the original value rather than the value
 in the action. This is important because if the value "abc" is submitted and can't be converted to an int, we want to
 display the original string ("abc") again rather than the int value (likely 0, which would make very little sense to
 the user).
 
 Note: Since 2.5.2, this interceptor extends MethodFilterInterceptor, therefore being
 able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
 (class DefaultWorkflowInterceptor) for documentation and examples on how to use this feature.
 
Interceptor parameters:
- None
Extending the interceptor:
Because this interceptor is not web-specific, it abstracts the logic for whether an error should be added. This allows for web-specific interceptors to use more complex logic in theshouldAddError(java.lang.String, java.lang.Object) method for when a value
 has a conversion error but is null or empty or otherwise indicates that the value was never actually entered by the
 user.
 
 Example code:
 
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="params"/>
     <interceptor-ref name="conversionError"/>
     <result name="success">good_result.ftl</result>
 </action>
 
 - Author:
- Jason Carreira
- See Also:
- 
Field SummaryFieldsFields inherited from class org.apache.struts2.interceptor.MethodFilterInterceptorexcludeMethods, includeMethods
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiondoIntercept(ActionInvocation invocation) Subclasses must override to implement the interceptor logic.protected Stringprotected ObjectgetOverrideExpr(ActionInvocation invocation, Object value) protected booleanshouldAddError(String propertyName, Object value) Methods inherited from class org.apache.struts2.interceptor.MethodFilterInterceptorapplyInterceptor, getExcludeMethodsSet, getIncludeMethodsSet, intercept, setExcludeMethods, setIncludeMethodsMethods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Field Details- 
ORIGINAL_PROPERTY_OVERRIDE- See Also:
 
 
- 
- 
Constructor Details- 
ConversionErrorInterceptorpublic ConversionErrorInterceptor()
 
- 
- 
Method Details- 
getOverrideExpr
- 
escape
- 
doInterceptDescription copied from class:MethodFilterInterceptorSubclasses must override to implement the interceptor logic.- Specified by:
- doInterceptin class- MethodFilterInterceptor
- Parameters:
- invocation- the action invocation
- Returns:
- the result of invocation
- Throws:
- Exception- in case of any errors
 
- 
shouldAddError
 
-