Point of integration between Struts and Spring Web Flow: a Struts Action that
acts a front controller entry point into the web flow system. A single
FlowAction may launch any new FlowExecution. In addition, a single Flow
Action may signal events in any existing/restored FlowExecutions.
Requests are managed by and delegated to a FlowExecutor , which this
class delegates to using a FlowRequestHandler (allowing reuse of
common front flow controller logic in other environments). Consult the
JavaDoc of those classes for more information on how requests are processed.
By default, to have this controller launch a new flow execution
(conversation), have the client send a
getFlowIdParameterName() request
parameter indicating the flow definition to launch.
To have this controller participate in an existing flow execution
(conversation), have the client send a
getFlowExecutionKeyParameterName()
request parameter identifying the conversation to participate in.
On each request received by this action, a StrutsExternalContext
object is created as input to the web flow system. This external source event
provides access to the action form, action mapping, and other struts-specific
constructs.
This class also is aware of the SpringBindingActionForm adapter,
which adapts Spring's data binding infrastructure (based on POJO binding, a
standard Errors interface, and property editor type conversion) to the Struts
action form model. This option gives backend web-tier developers full support
for POJO-based binding with minimal hassel, while still providing consistency
to view developers who already have a lot of experience with Struts for
markup and request dispatching.
Below is an example struts-config.xml configuration for a
FlowAction:
This example associates the logical request URL
/userRegistration.do as a Flow controller. It is expected that
flows to launch be provided in a dynamic fashion by the views (allowing this
single FlowAction to manage any number of flow executions). A
Spring binding action form instance is set in request scope, acting as an
adapter enabling POJO-based binding and validation with Spring.
Other notes regarding Struts/Spring Web Flow integration:
Logical view names returned when ViewStates and
EndStates are entered are mapped to physical view templates
using standard Struts action forwards (typically global forwards).
Use of the SpringBindingActionForm requires no special
setup in struts-config.xml: simply declare a form bean in
request scope of the class
org.springframework.web.struts.SpringBindingActionForm and use
it with your FlowAction.
This class depends on a FlowExecutor instance to be configured.
If relying on Spring's DelegatingActionProxy (which is
recommended), a FlowExecutor reference can simply be injected using standard
Spring DependencyInjection techniques. If you are not using the proxy-based
approach, this class will attempt a root context lookup on initialization,
first querying for a bean of instance FlowExecutor named
FLOW_EXECUTOR_BEAN_NAME , then, if not found, querying for a bean of
instance FlowLocator named FLOW_LOCATOR_BEAN_NAME . If the
FlowLocator dependency is resolved, this class will automatically configure a
default flow executor implementation suitable for a Struts environment (see
setFlowLocator(FlowLocator) ). In addition, you may choose to simply
inject a FlowLocator directly if the FlowExecutor defaults meet your
requirements.
The benefits here are substantial: developers now have a powerful web flow
capability integrated with Struts, with a consistent-approach to POJO-based
binding and validation that addresses the proliferation of
ActionForm classes found in traditional Struts-based apps.
Requests are managed by and delegated to a FlowExecutor , which this class delegates to using a FlowRequestHandler (allowing reuse of common front flow controller logic in other environments). Consult the JavaDoc of those classes for more information on how requests are processed.
On each request received by this action, a StrutsExternalContext object is created as input to the web flow system. This external source event provides access to the action form, action mapping, and other struts-specific constructs.
This class also is aware of the SpringBindingActionForm adapter, which adapts Spring's data binding infrastructure (based on POJO binding, a standard Errors interface, and property editor type conversion) to the Struts action form model. This option gives backend web-tier developers full support for POJO-based binding with minimal hassel, while still providing consistency to view developers who already have a lot of experience with Struts for markup and request dispatching.
Below is an example
struts-config.xmlconfiguration for a FlowAction:<action path="/userRegistration" type="org.springframework.webflow.executor.struts.FlowAction" name="springBindingActionForm" scope="request"> </action>This example associates the logical request URL/userRegistration.doas a Flow controller. It is expected that flows to launch be provided in a dynamic fashion by the views (allowing this singleFlowActionto manage any number of flow executions). A Spring binding action form instance is set in request scope, acting as an adapter enabling POJO-based binding and validation with Spring.Other notes regarding Struts/Spring Web Flow integration:
ViewStatesandEndStatesare entered are mapped to physical view templates using standard Struts action forwards (typically global forwards).SpringBindingActionFormrequires no special setup instruts-config.xml: simply declare a form bean in request scope of the classorg.springframework.web.struts.SpringBindingActionFormand use it with your FlowAction.The benefits here are substantial: developers now have a powerful web flow capability integrated with Struts, with a consistent-approach to POJO-based binding and validation that addresses the proliferation of
ActionFormclasses found in traditional Struts-based apps.