Class MultiAction
java.lang.Object
org.springframework.webflow.action.AbstractAction
org.springframework.webflow.action.MultiAction
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,Action
- Direct Known Subclasses:
FormAction
Action implementation that bundles two or more action execution methods into a single class. Action execution methods
defined by subclasses must adhere to the following signature:
public Event ${method}(RequestContext context) throws Exception;When this action is invoked, by default the
id
of the calling action state state is treated as the
action execution method name. Alternatively, the execution method name may be explicitly specified as a attribute of
the calling action state.
For example, the following action state definition:
<action-state id="search"> <evaluate expression="searchAction.executeSearch"/> <transition on="success" to="results"/> </action-state>... when entered, executes the method:
public Event search(RequestContext context) throws Exception;
One use of the MultiAction is to centralize all command logic for a flow in one place. Another use is to centralize form setup and submit logic in one place, or CRUD (create/read/update/delete) operations for a single domain object in one place.
- Author:
- Keith Donald, Erwin Vervaet
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Strategy interface used by the MultiAction to map a request context to the name of an action execution method. -
Field Summary
Fields inherited from class org.springframework.webflow.action.AbstractAction
logger
-
Constructor Summary
ModifierConstructorDescriptionprotected
Protected default constructor; not invokable for direct MultiAction instantiation.MultiAction
(Object target) Constructs a multi action that invokes methods on the specified target object. -
Method Summary
Modifier and TypeMethodDescriptionprotected final Event
doExecute
(RequestContext context) Template hook method subclasses should override to encapsulate their specific action execution logic.Get the strategy used to resolve action execution method names.void
setMethodResolver
(MultiAction.MethodResolver methodResolver) Set the strategy used to resolve action execution method names.protected final void
Sets the target of this multi action's invocations.Methods inherited from class org.springframework.webflow.action.AbstractAction
afterPropertiesSet, doPostExecute, doPreExecute, error, error, execute, getActionNameForLogging, getEventFactorySupport, initAction, no, result, result, result, result, success, success, yes
-
Constructor Details
-
MultiAction
protected MultiAction()Protected default constructor; not invokable for direct MultiAction instantiation. Intended for use by subclasses.Sets the target to this multi action instance.
- See Also:
-
MultiAction
Constructs a multi action that invokes methods on the specified target object. Note: invokable methods on the target must conform to the multi action method signature:public Event ${method}(RequestContext context) throws Exception;
- Parameters:
target
- the target of this multi action's invocations
-
-
Method Details
-
setTarget
Sets the target of this multi action's invocations.- Parameters:
target
- the target
-
getMethodResolver
Get the strategy used to resolve action execution method names. -
setMethodResolver
Set the strategy used to resolve action execution method names. Allows full control over the method resolution algorithm. Defaults toDefaultMultiActionMethodResolver
. -
doExecute
Description copied from class:AbstractAction
Template hook method subclasses should override to encapsulate their specific action execution logic.- Specified by:
doExecute
in classAbstractAction
- Parameters:
context
- the action execution context, for accessing and setting data in "flow scope" or "request scope"- Returns:
- the action result event
- Throws:
Exception
- an unrecoverable exception occured, either checked or unchecked
-