3

已实现如下 switch 语句。

如有错误,请您核实并更正?

<set name="flowScope.Valid" value="true">
<decision-state id="isDNCheckNotRequired" test="Valid == true">
<transition on="true" to="even"/>
<transition on="false" to="odd"/>
</decision-state>

<action-state id="even">
<evaluate expression="Test.setEven(true)">
</action-state>

<action-state id="odd">
<evaluate expression="Test.set(false)">
</action-state>

请让我知道这种实现方式在 spring webflow 2.0 中是否支持

提前致谢。

4

1 回答 1

8

引用文档

对于决策状态

<decision-state id="moreAnswersNeeded">
    <if test="interview.moreAnswersNeeded()" then="answerQuestions" else="finish" />
</decision-state>

作为替代

<action-state id="moreAnswersNeeded">
    <evaluate expression="interview.moreAnswersNeeded()" />
    <transition on="yes" to="answerQuestions" />
    <transition on="no" to="finish" />
</action-state>

类比视图状态

<view-state id="uploadFile" model="uploadFileHandler">
    <var name="fileUploadHandler" class="org.springframework.webflow.samples.booking.FileUploadHandler" />
    <transition on="upload" to="finish" >
        <evaluate expression="fileUploadHandler.processFile()"/>
    </transition>
    <transition on="cancel" to="finish" bind="false"/>
</view-state>

请参阅:http ://docs.spring.io/spring-webflow/docs/2.3.4.RELEASE/reference/html/actions.html#decision-state

于 2013-03-16T20:07:47.550 回答