在Spring Webflow中设置多个if else条件决策状态ID

时间:2017-06-27 17:35:53

标签: java spring-webflow

我正在研究现有的Spring Webflow应用程序。我在子流中设置了一个变量,我想使用决策状态来确定动作类。应用程序已经指定了决策状态ID

<decision-state id="condition1">
        <if test="flowScope.conditionCheck1 || flowScope.conditionCheck2" then="action1" else="action2"/>
</decision-state>

现在我想测试condition3是否为true,如果是,我想执行action3。有没有人知道我该怎么做?

2 个答案:

答案 0 :(得分:2)

要编写if else条件我写了多个如果条件在“decision-state-id”中,否则条件写在最后的if条件中并且它对我来说很好。

<decision-state id="condition1">
    <if test="flowScope.conditionCheck1 || flowScope.conditionCheck2" then="action1"/>
    <if test="flowScope.conditionCheck3 then="action3" else="action2"/>
</decision-state>

答案 1 :(得分:0)

将你的条件和决定分开如下:

<decision-state id="condition1">
    <if test="flowScope.conditionCheck3" then="action3" else="condition1or2"/>
</decision-state>
<decision-state id="condition1or2">
    <if test="flowScope.conditionCheck1 || flowScope.conditionCheck1" then="action1" else="action2"/>
</decision-state>