How to access valuestack objects within struts iterator?
Posted
by
Monika Michael
on Stack Overflow
See other posts from Stack Overflow
or by Monika Michael
Published on 2012-04-12T11:16:21Z
Indexed on
2012/04/12
11:29 UTC
Read the original article
Hit count: 261
I have following code -
<s:iterator value="reviews">
<img src="<s:property value="#request.restaurant.portalImage.url" />" />
<s:property value="user.firstName" />
<s:property value="user.lastName" />
<s:property value="rating" />
<s:property value="review" />
</s:iterator>
reviews is a list of review objects which contain details of a review, such as rating and name of user.
My problem is that i'm not able to access any of the objects present on the valuestack within the loop.
Outside the loop <s:property value="#request.restaurant.portalImage.url" />
works correctly. But within the loop it prints null.
AFAIK an iterator pushes it's collection on the valuestack so that all ognl expressions resolve against it. But I've used # which means I'm explicitly specifying the root object for resolution.
Why is it still not working?
© Stack Overflow or respective owner