Java 将引用属性传递给SpringWebFlow中的操作状态求值
我试图在SpringWebFlow中向evaluate标记传递一个参数Java 将引用属性传递给SpringWebFlow中的操作状态求值,java,spring,spring-webflow,Java,Spring,Spring Webflow,我试图在SpringWebFlow中向evaluate标记传递一个参数 <action-state id="activateOption"> <evaluate expression="someService.call()" result="flowScope.serviceResult" result-type="java.lang.String"> **<attribute name="x" value="flowScope.servic
<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>
它以另一种状态返回字符串“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的值:
RequestContextHolder.getRequestContext().getFlowScope().get("serviceInput")
在集合表达式中,根据requestContext作用域的变量-值对计算值
在“计算表达式”中,表达式也是在requestContext中计算的(不是属性值)。因此,在requestContext范围的变量-值对中不会有属性值的查找,但它是按照流定义中的指定捕获的。这就是原因,对于evaluate属性,您得到的值为“flowScope.serviceInput”,而对于set属性,则得到其中包含的值
但您可以尝试使用EL将其作为:
<attribute name="x" value="#{flowScope.serviceInput}"/>
for SWF version > 2.1
对于SWF版本>2.1
或与
<attribute name="x" value="${flowScope.serviceInput}"/>
for SWF version < 2.1 where ever you are setting this attribute value.
对于SWF版本<2.1,无论您在何处设置此属性值。
您能否详细说明“它返回字符串”flowScope.serviceInput“而不是该表达式的值”。您希望在您的场景中执行什么计算?@Prasad I need.getAttributes().get(“x”)返回flowScope.serviceInput变量的值,我以前在流的另一个状态中设置了该变量,不是字符串“flowScope.serviceInput”谢谢,EL解决方案满足需要。到目前为止,我还没有幸配置EL,但这是另一个问题。再次感谢。
<attribute name="x" value="${flowScope.serviceInput}"/>
for SWF version < 2.1 where ever you are setting this attribute value.