java 如何将参数传递给 Struts 2 OGNL 中的方法调用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2945684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 23:36:28  来源:igfitidea点击:

How to pass parameter to method call in Struts 2 OGNL

javastruts2ognl

提问by Roy Chan

I want to use a property as a param of an object's method.

我想使用一个属性作为对象方法的参数。

<s:property value="orderProductId" />

returns correct value (e.g. 1)

返回正确的值(例如 1)

<s:iterator value="%{order.getProductById(1).activations}">

gives me correct value too. But

也给了我正确的价值。但

<s:iterator value="%{order.getProductById(#orderProductId).activations}">

doesn't. Not sure why #orderProductId doesn't interpret correctly.

没有。不知道为什么 #orderProductId 不能正确解释。

回答by leonbloy

Ah, the joy of %#$ in OGNL... This doesn't work ?

啊,OGNL 中 %#$ 的乐趣...这行不通?

<s:iterator value="%{order.getProductById(orderProductId).activations}">