Name | ActionFlow Plugin |
---|---|
Publisher | |
License | Open Source (ASL2) |
Version | 2.01.0 |
Compatibility | Struts 2.3.4 + |
Homepage |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<dependencies> ... <dependency> <groupId>com.amashchenko.struts2.actionflow</groupId> <artifactId>struts2-actionflow-plugin</artifactId> <version>2.01.0</version> </dependency> ... </dependencies> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
@ActionFlowScope
public class FlowAction extends ActionSupport {
@ActionFlowScope
private String name;
}
|
Showing action flow steps in JSP
Available from struts2-actionflow-plugin 2.1.0
Implement ActionFlowStepsAware
interface in action and create getter for ActionFlowStepsData
:
Code Block | ||||
---|---|---|---|---|
| ||||
public class FlowAction extends ActionSupport implements ActionFlowStepsAware {
private ActionFlowStepsData stepsData;
@Override
public void setActionFlowSteps(ActionFlowStepsData stepsData) {
this.stepsData = stepsData;
}
public ActionFlowStepsData getStepsData() {
return stepsData;
}
}
|
In JSP iterate over ActionFlowStepsData#steps
map. Use #key
and #value
to get step index (starting from 1) and action name. The ActionFlowStepsData#stepIndex
property holds index of current step.
Code Block | ||||
---|---|---|---|---|
| ||||
<ul>
<s:iterator value="stepsData.steps">
<s:if test="stepsData.stepIndex > key">
<s:set var="status" value="'passed'"/>
</s:if>
<s:elseif test="stepsData.stepIndex == key">
<s:set var="status" value="'active'"/>
</s:elseif>
<s:else>
<s:set var="status" value="'simple'"/>
</s:else>
<li class="<s:property value="#status"/>">
<s:property value="key"/> <s:property value="value"/>
</li>
</s:iterator>
</ul>
|