【发布时间】:2014-09-07 00:58:03
【问题描述】:
我正在尝试将参数传递给 Spring WebFlow 中的评估标签
<action-state id="activateOption">
<evaluate expression="someService.call()" result="flowScope.serviceResult" result-type="java.lang.String">
**<attribute name="x" value="flowScope.serviceInput"/>**
</evaluate>
<transition on="0" to="Stop_View"/>
</action-state>
在 SomeService bean 中,当我像这样检索 x 参数时:
RequestContextHolder.getRequestContext().getAttributes().get("x")
它返回字符串“flowScope.serviceInput”,而不是我之前在流中设置的 flowScope.serviceInput 的值,处于另一个状态。
我可以像这样在输入时传递参考值:
<action-state id="some action">
<on-entry>
<set name="flowScope.someName" value="flowScope.someOtherParam + ' anything!!'" type="java.lang.String"/>
</on-entry>
为什么我在设置属性时不能这样做?
解决方法不起作用,因为我们正试图以这种方式生成流。
谢谢!
【问题讨论】:
-
您能否详细说明“它返回字符串“flowScope.serviceInput”而不是该表达式的值。”您希望评估在您的场景中执行什么?
-
@Prasad 我需要 .getAttributes().get("x") 来返回 flowScope.serviceInput 变量的值,我之前已将其设置为流的另一种状态,而不是字符串“flowScope.serviceInput”
标签: java spring spring-webflow