aspose file tools*
The moose likes Struts and the fly likes Issue in using <s:iterator /> within another <s:iterator /> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Issue in using <s:iterator /> within another <s:iterator /> " Watch "Issue in using <s:iterator /> within another <s:iterator /> " New topic
Author

Issue in using <s:iterator /> within another <s:iterator />

camp jay
Greenhorn

Joined: Jun 17, 2009
Posts: 4

I'm iterating object<HOUSE> list in JSP.



And in this HOUSE object I have another object<ROOMS> list. I need to iterate Room list within House list iterator and need to access HOUSE properties also within Room iterator.

i.e



Can you tell me how to access properties of two objects separately in inner iterator?
I guess there might be better approach to this.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You can't nest custom tags like that.

The correct course of action is to use the "var" attribute (or "id", depending on which version of Struts 2 you're using) to capture each object being iterated over in both loops.
 
 
subject: Issue in using <s:iterator /> within another <s:iterator />