spring webflow, evaluate expression ignored in transition

▼魔方 西西 提交于 2019-12-11 01:24:14

问题


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:

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

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?


回答1:


http://static.springsource.org/spring-webflow/docs/2.3.x/reference/htmlsingle/spring-webflow-reference.html#view-transitions

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.

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.)

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>


来源:https://stackoverflow.com/questions/12388574/spring-webflow-evaluate-expression-ignored-in-transition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!