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.
The Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to reference and manipulate data on the ValueStack. OGNL also helps in data transfer and type conversion. The OGNL is very similar to the JSP Expression Language.
Object-Graph Navigation Language is an open-source Expression Language (EL) for Java objects. Specifically, OGNL enables the evaluation of EL expressions in Apache Struts, which is the commonly used development framework for Java-based web applications in enterprise environments.
A valueStack is simply a stack that contains application specific objects such as action objects and other model object. At the execution time, action is placed on the top of the stack. We can put objects in the valuestack, query it and delete it.
A root is a default object in the context map and all objects it contains could be referenced without # . Framework sets this object to value stack.
Ah, the joy of %#$ in OGNL... This doesn't work ?
<s:iterator value="%{order.getProductById(orderProductId).activations}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With