Spring Webflow,评估转换中忽略的表达式 [英] spring webflow, evaluate expression ignored in transition

查看:182
本文介绍了Spring Webflow,评估转换中忽略的表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个流程定义为流程

I have a flow definition as flows

<view-state id="view1" view="/jsp/view1.xhtml">
    <transition on="login" to="view1" >
       <evaluate expression="'test1'" result="viewScope.t1"/>
       <evaluate expression="'test2'" result="viewScope.t2"/>
    </transition>
</view-state>

View1.xhtml:

View1.xhtml:

${t1}<br/>
${t2}

在view1.xhtml中,我打印了两个变量t1和t2,但仅打印了"test1".第二个表达式在过渡时被忽略.为什么会这样?

In view1.xhtml, I printed the two variables t1 and t2, but only 'test1' is printed. The second expression is ignored in transition. Why this happened?

推荐答案

在一个转换中定义了多个动作时,如果一个动作返回错误结果,则该集合中的其余动作将不会执行.

When there is more than one action defined on a transition, if one returns an error result the remaining actions in the set will not be executed.

现在,也请阅读该部分,我认为只有false会被视为错误结果,但也许除了成功"值以外,什么都没有.您的经验似乎证明了这一点. (我以为我在发现返回值被视为成功和失败的地方找到了一个列表,但我现在不在那儿.)

Now, also reading that section, I thought that only false would be considered an error result, but perhaps it's anything other than "success" values. Your experience seems to bear that out. (I thought I had found a list somewhere of what return values are considered success and failure, but I'm not locating that right now.)

但是,您可以使用<set>代替<evaluate>吗?

But, instead of <evaluate>, can you use <set>?

<transition on="login" to="view1" >
    <set name="viewScope.t1" value="'test1'" />
    <set name="viewScope.t2" value="'test2'" />
</transition>

这篇关于Spring Webflow,评估转换中忽略的表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆