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

Win a copy of The Software Craftsman this week in the Agile forum!
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

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

camp jay

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.


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

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.
Have you tried LearnNowOnline?
subject: Issue in using <s:iterator /> within another <s:iterator />