Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Issue in using <s:iterator /> within another <s:iterator />
Joined: Jun 17, 2009
Jan 06, 2010 21:00:42
I'm iterating object<HOUSE> list in
<s:iterator value="Houselist" status="hcount" >
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.
<s:iterator value="Houselist" status="hcount" > <s:iterator value='<s:property value="lstRooms" />' status="rcount" > <!-- Is it correct to assign iterator value in this way or any other proper method ? --> <!-- Here I need to access House properties as well as room properties --> </s:iterator> </s: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.
Joined: Sep 29, 2008
Jan 07, 2010 06:19:27
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 />
Struts2 - <s:iterator> in two-Dimensional Array.
Sticky nested lists problem in Struts 2
Struts 2 - Problem updating textfields created by iterating over a list of objects
lists inside a list :(((
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013