How to pass parameter to method call in Struts 2 OGNL

Roy Chan picture Roy Chan · May 31, 2010 · Viewed 12.2k times · Source

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

<s:property value="orderProductId" />

returns correct value (e.g. 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.

Answer

leonbloy picture leonbloy · May 31, 2010

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

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