Class FormFormatterInterceptor

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

public class FormFormatterInterceptor extends AbstractInterceptor

Struts 2 Interceptor used by view Actions for writing formatted versions of forms onto the Value Stack, so they're displayed instead of the unformatted form, using any conversion annotations on form fields. Such forms must implement FormattableForm. Does not apply to injected forms as its conversion errors are copied.

Interceptor parameters:

disabled
If true, all processing for this action is disabled. Defaults to false.

Extending the interceptor:

The following methods can be overridden :-

makeFormFormatLibrary
Creates helper that formats form.
makePolicyLookup
Creates helper that finds policy implementation from the annotation that configures it.

Example code:

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

    • FormFormatterInterceptor

      public FormFormatterInterceptor()
  • Method Details

    • makeFormFormatLibrary

      protected FormFormatter makeFormFormatLibrary()
      Creates and returns helper that formats form field values.
    • makePolicyLookup

      protected PolicyLookup makePolicyLookup()
      Creates and returns helper that finds a policy implementation from a form field adjuster, converter, or validator annotation. Does not scan for non-built-in, non-custom policies if disabledClassScanner is true.
    • getDisabled

      public boolean getDisabled()
    • setDisabled

      public void setDisabled(boolean disabled)
    • intercept

      public String intercept(ActionInvocation invocation) throws Exception
      Specified by:
      intercept in interface Interceptor
      Specified by:
      intercept in class AbstractInterceptor
      Throws:
      Exception