File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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.
I agree. Here's the link:
subject: Issue in using <s:iterator /> within another <s:iterator />
It's not a secret anymore!