编程语言
首页 > 编程语言> > java – 如何在spring webflow中实现Switch / if else if语句?

java – 如何在spring webflow中实现Switch / if else if语句?

作者:互联网

已实现如下的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>

请告诉我这是春天webflow 2.0中的实现方式

提前致谢.

解决方法:

引用文档

对于决策状态

<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

标签:java,spring,spring-mvc,spring-webflow
来源: https://codeday.me/bug/20190729/1568517.html