【问题标题】:Spring Webflow - Best practice for generalized decision stateSpring Webflow - 广义决策状态的最佳实践
【发布时间】:2021-03-19 02:53:17
【问题描述】:

在流程中,我正在使用决策状态检查会话是否已过期,如果是,那么它应该重定向到错误页面,如果不是,流程应该继续。

现在我想要两个不同的转换来调用决策状态,所以我为它们中的每一个创建两个决策状态。

<transition on="A" to="checkA"/>
<transition on="B" to="checkB"/>

<decision-state id="checkA">
    <if test="error?" then="error" else="doA"/>
</decision-state>

<decision-state id="checkB">
    <if test="error?" then="error" else="doB"/>
</decision-state>

那么,有没有其他方法可以让我做出一个可以检查错误的通用决策状态,如果是,则进入错误状态,否则继续其应该继续的转换。

提前谢谢你,

【问题讨论】:

标签: java spring spring-webflow


【解决方案1】:

根据上面的警告,我认为这实际上不适用于您描述的检查过期会话的情况,流 XML 文件可以像这样使用#{} template expressions

<transition on="A" to="checkCondition">
    <set name="flowScope.nextState" value="doA"/>
</transition>
<transition on="B" to="checkCondition">
    <set name="flowScope.nextState" value="doB"/>
</transition>

<decision-state id="checkCondition">
    <if test="error?" then="error" else="#{flowScope.nextState}"/>
</decision-state>

【讨论】:

    猜你喜欢
    • 2010-12-22
    • 2012-08-13
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    • 2014-02-20
    • 1970-01-01
    • 1970-01-01
    • 2022-08-13
    相关资源
    最近更新 更多