Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Name

Spring Webflow Plugin

Author

Tom Schneider

Homepage

http://code.google.com/p/struts2webflow/

Version

1.0.0

Compatibility

Struts 2.0.2+

State

Production

License

Open Source (ASL2)

Download

http://code.google.com/p/struts2webflow/downloads/list

...

This plugin

Excerpt

integrates Spring Webflow (SWF) with Struts 2

. It allows struts2 Struts 2 to execute spring webflows and allows spring webflows to have struts2 Struts 2 actions as webflow actions. There is also a sample car insurance app that illustrates usage of the plugin.

Features

  • Allows struts2 Struts 2 to execute spring webflows
  • Allows struts2 Struts 2 actions to be invoked by spring webflow.
  • Includes an interceptor that injects flow scope properties into struts2 Struts 2 actions.
  • Includes an annotation-based interceptor that injects flow scope properties into struts2 Struts 2 actions.
  • SWF flow execution key can be managed in the session rather than as a hidden field on the client.

...

The Struts2FlowAdapter allows a struts2 Struts 2 action to execute a webflow action-state. The Struts2FlowAdapter uses the id of the action state as the name of struts2 Struts 2 action to execute. The alwaysRedirectOnPause is disabled because whether to redirect or not is easier to control in the struts2 Struts 2 configuration files.

Step 3 - Add SWF interceptors to

...

Struts's struts.xml configuration file

Code Block
<interceptors>
	<interceptor name="sessionFlowExecKey" class="com.googlecode.struts2webflow.SessionFlowExecKeyInterceptor"/>
	<interceptor name="annotationflowScope" class="com.googlecode.struts2webflow.annotations.AnnotationFlowScopeInterceptor"/>
</interceptors>

The SessionFlowExecKeyInterceptor puts the flow execution key in the session rather than having it as a hidden field on the form that submitted back. The AnnotationFlowScopeInterceptor uses annotations to bind struts2 Struts 2 action variables to and from flow scope. Before an action executes, this interceptor looks for @FlowIn annotated properties of the struts2 Struts 2 action and populates the these actions from flow scope. After the action has executed, properties annotated with the @FlowOut annotation are put back into flow scope.

...