Open Source (ASL2)
Struts 2.3.4 +
A Struts2 plugin for creating wizards (action flows)
plugin for creating wizards (action flows)
- Simple integration to new or existing Struts2 application
- Automatic use of Post/Redirect/Get pattern to avoid duplicate form submissions
- Proper handling of browser back and refresh buttons
- Action flow scope to keep data, there is no need to use scoped model-driven
Showcase application could be downloaded from the Maven Central Repository.
Copy struts2-actionflow-plugin-x.x.x.jar into your classpath
WEB-INF/lib. No other files need to be copied or created.
If you are using Maven, add this to your project POM:
1. Install it by adding this plug-in dependency to your POM or by copying jar into /WEB-INF/lib directory.
2. Make your action package extend
<param name="actionFlowStep"> parameters to actions you want to include in action flows. (NOTE: the action must have an input result!)
prev actions in JSP to move between wizard steps.
@ActionFlowScope annotation on action classes and fields in order to keep data in action flow scope.
Note: Since Struts2 version 184.108.40.206 if you are using
<s:submit> tags with
action attribute you need to enable support for
Put that in your struts.xml file:
Showing action flow steps in JSP
Available from struts2-actionflow-plugin 2.1.0
ActionFlowStepsAware interface in action and create getter for
In JSP iterate over
ActionFlowStepsData#steps map. Use
#value to get step index (starting from 1) and action name. The
ActionFlowStepsData#stepIndex property holds index of current step.
Controlling action flow
Available from struts2-actionflow-plugin 2.3.0
Implementing ActionFlowAware interface gives you ability to change flow of actions.
The nextActionFlowAction method controls which flow action will be executed next. Return the name of the flow action which should be executed after the action
which is passed as currentActionName argument. E.g. if wizard consists of three actions: 'saveName' > 'savePhone' > 'saveEmail', and
action 'savePhone' must be skipped return 'saveEmail' from this method when method argument currentActionName is 'saveName'.
On returning not a flow action name or null, action flow won't be changed (i.e. the configured next action from the flow will be executed).
The action properties values passed for the current action will be available in nextActionFlowAction method.
As a result of that you can skip actions based on user input and current action name.