Class FormRetrieveInterceptor
java.lang.Object
com.opensymphony.xwork2.interceptor.AbstractInterceptor
name.matthewgreet.strutscommons.interceptor.FormRetrieveInterceptor
- All Implemented Interfaces:
com.opensymphony.xwork2.interceptor.Interceptor
,Serializable
public class FormRetrieveInterceptor
extends com.opensymphony.xwork2.interceptor.AbstractInterceptor
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 aflViewStack 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 overriden :-
- 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 void
Deletes stored form as unused.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.boolean
Returns whether Action will not retrieve forms.protected void
injectForm
(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) Injects form into specific field.intercept
(com.opensymphony.xwork2.ActionInvocation invocation) protected void
restoreForm
(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm) Injects stored form into receiving field of current action and pushes conversion errors onto the Value Stack.void
setDisabled
(boolean value) Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
destroy, init
-
Constructor Details
-
FormRetrieveInterceptor
public FormRetrieveInterceptor()
-
-
Method Details
-
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(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) throws Exception Injects form into specific field.- Throws:
Exception
-
restoreForm
protected void restoreForm(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm) 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:
intercept
in interfacecom.opensymphony.xwork2.interceptor.Interceptor
- Specified by:
intercept
in classcom.opensymphony.xwork2.interceptor.AbstractInterceptor
- Throws:
Exception
-