我是使用Spring Webflow的新手。我正在尝试使用全局转换。在我的jsp中,我试图使用
显示所有过渡<c:forEach var="transition" items="${flowRequestContext.currentState.transitions}">
<c:out value="${transition.id}"/>
</c:forEach>
我可以看到currentState的所有转换,但是我看不到全局转换。
我的理解是所有视图状态都可以使用全局转换。要获得全局转换,我是否需要以不同的方式访问它?
这是我的flow xml的简化版本
<flow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/webflow"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<view-state id="state1" view="view1.jsp" model="person">
<transition on="submit" to="state2"/>
<transition on="cancel" to="canceled"/>
</view-state>
<view-state id="state2" view="view1.jsp" model="person">
<transition on="complete" to="complete"/>
</view-state>
<view-state id="canceled" view="view1.jsp" model="person">
<transition on="resubmit" to="resubmit"/>
</view-state>
<action-state id="reassign">
<evaluate expression="CustomAction.reassign(flowRequestContext)"/>
</action-state>
<end-state id="complete"/>
<global-transitions>
<transition on="cancel" to="canceled"/>
<transition on="reassign" to="reassign"/>
</global-transitions>
</flow>
所以当在jsp中的state1中我怎样才能显示包括全局的所有traentions?
感谢您提前提供任何帮助
答案 0 :(得分:1)
Better late than never. There is a getGlobalTransitionSet method, but it's in the implementation org.springframework.webflow.engine.Flow class, not in the interface FlowDefinition. This method returns a TransitionSet that is not iterable by forEach, but fortunatelly it has a toArray method.
If you feel comfortable with this, you could use:
${flowRequestContext.activeFlow.globalTransitionSet.toArray()}
Tested.