Class FormRetrieveInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
name.matthewgreet.strutscommons.interceptor.FormRetrieveInterceptor
- All Implemented Interfaces:
Serializable,ConditionalInterceptor,Interceptor
Retrieves a form stored in the session by FormStoreInterceptor and injects it into the action's member
variable configured by the Form annotation to accept it. It is usually part of the ViewStack interceptor
stack so a view action can display rejected form data.
Interceptor parameters
- disabled
- If true, all processing is disabled. This is useful for standalone popup windows, especially self-refreshing ones, that never display messages. Defaults to false.
Extending the interceptor
The following method could be overridden :-
- fieldReceives
- Whether Struts action member variable can be set to the stored form.
Example code
@InterceptorRefs({
@InterceptorRef(value="formRetrieve"),
@InterceptorRef(value="basicStack")
})
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddConversionErrors(ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) Adds stored conversion errors.protected voidDeletes stored form as unused.protected booleanfieldReceives(Class<?> actionClass, Field field, FormStoreInterceptor.StoredForm storedForm) Returns whether Struts action member variable can be set to the stored form, which is whether the member variable's type is compatible with the form andForm.reception()annotation settings accept form validation status.booleanReturns whether Action will not retrieve forms.protected voidinjectForm(ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) Injects form into specific field.intercept(ActionInvocation invocation) protected voidrestoreForm(ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm) Injects stored form into receiving field of current action and pushes conversion errors onto the Value Stack.voidsetDisabled(boolean value) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptor
destroy, init, setDisabled, shouldIntercept
-
Constructor Details
-
FormRetrieveInterceptor
public FormRetrieveInterceptor()
-
-
Method Details
-
addConversionErrors
protected void addConversionErrors(ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) throws Exception Adds stored conversion errors.- Throws:
Exception
-
deleteStoredForm
protected void deleteStoredForm()Deletes stored form as unused. -
fieldReceives
protected boolean fieldReceives(Class<?> actionClass, Field field, FormStoreInterceptor.StoredForm storedForm) Returns whether Struts action member variable can be set to the stored form, which is whether the member variable's type is compatible with the form andForm.reception()annotation settings accept form validation status. -
injectForm
protected void injectForm(ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) throws Exception Injects form into specific field.- Throws:
Exception
-
restoreForm
Injects stored form into receiving field of current action and pushes conversion errors onto the Value Stack. -
getDisabled
public boolean getDisabled()Returns whether Action will not retrieve forms. -
setDisabled
public void setDisabled(boolean value) -
intercept
- Specified by:
interceptin interfaceInterceptor- Specified by:
interceptin classAbstractInterceptor- Throws:
Exception
-