spring - View 状态内 webflow 中的 If & Else 语句

标签 spring spring-webflow

我有以下 View 状态:

<view-state id="editbestellung" view="eap/orderedit.xhtml"
    model="flowScope.entity">
    <transition on="save" to="eaporderlist" bind="true">
        <evaluate
            expression="eapBestellungDelegate.save(flowScope.entity,currentUser.name)" />
    </transition>
</view-state>

没有其他地方,我将 flowScope.isToDo 设置为 true
现在我需要检查这个 flowScope 是否为真。如果是,transition 应该重定向 to="eapordertodolist",如果是 false,它应该重定向到 to="eaporderlist"。< br/> 但我只知道如何设置 if 语句:

<if test="testingMethod()" then="view-state when true" else="view-state when false" />

那么如何在上面的 View 状态中实现 if 语句并执行所需的操作?

最佳答案

使用Decision-States

Use the decision-state element as an alternative to the action-state to make a routing decision using a convenient if/else syntax. The example below shows the moreAnswersNeeded state above now implemented as a decision state instead of an action-state

您的 editbestellung 状态将如下所示(注意我将 更改为):

<view-state id="editbestellung" view="eap/orderedit.xhtml"
    model="flowScope.entity">
    <transition on="save" to="eaporderdecision" bind="true">
        <evaluate
            expression="eapBestellungDelegate.save(flowScope.entity,currentUser.name)" />
    </transition>
</view-state>

然后添加决策状态:

<decision-state id="eaporderdecision">
    <if test="flowScope.isToDo" then="eapordertodolist" else="eaporderlist" />
</decision-state>

关于spring - View 状态内 webflow 中的 If & Else 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18330907/

相关文章:

java - spring 处理存储库方法的方法

java - 在 Spring 元素中引用 css 文件

java - Spring Cloud Function/将请求传播到 Function

java - 如何从 JSF/Webflow 应用程序提供二进制内容?

java - 什么是在我的部署中设置 Cache-Control no-cache, no-store?

grails - 为什么 Jetty 寻找 JSP 而不是 GSP?

spring-mvc - MVC Controller 和 Web Flow Controller - 请求处理优先级

spring - EHCache:缓存简单已经存在

android - 使用 spring android resttemplate 和 android 注释设置标题

java - Spring 网络流量 : Move through view states