Class AnnotationValidationInterceptor

All Implemented Interfaces:
ConditionalInterceptor, Interceptor, Serializable, ConditionalInterceptor, Interceptor

@Deprecated public class AnnotationValidationInterceptor extends MethodFilterInterceptor
Deprecated.
Only recognises form fields in formatted/unformatted pairs (pair conversion mode). Use AnnotationValidationInterceptor2, which recognises this and other modes.

Struts 2 Interceptor for parsing annotated form fields from strings to another data type and writes error messages where data type conversion fails. If the Action implements ModelDriven, the model is recognised as the form, not the action. Struts Actions are expected to implement ValidationAware and, if message keys are used, implement TextProvider.

This differs from the standard ConversionErrorInterceptor by allowing writing to the general error list, not just field errors, and, if a message key is used, using the Action's text provider directly, not going through the Value Stack.

Interceptor parameters:

disabled
If true, this interceptor is skipped. Defaults to false.

Extending the interceptor:

Various points of the core algorithm can be overridden to customize behaviour. See javadoc of protected methods.

Example code:

 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="annotationValidation"/>
     <interceptor-ref name="validation"/>
     <result name="success">good_result.ftl</result>
 </action>
 
 
See Also:
  • Constructor Details

    • AnnotationValidationInterceptor

      public AnnotationValidationInterceptor()
      Deprecated.
  • Method Details