tmonteit
asked on
JSTL Scope problem
I have 3 Beans: A, B, and C
// Assume getters and setters exist for all element.
// Class A wraps B and C.
public class ABean{
private B b;
// ArrayList of C's
private ArrayList cList;
}
class BBean{
private String name;
private String id;
}
class CBean{
private String name;
private String id;
private String color;
}
//// Now we have some JSTL Code
<nested:iterate iproperty="cList" >
Color = <nested:write property="color" />
Now I want to write the value of another bean in this iterate loop.
How do I write? the value of BBean.id here?
</nested:iterate>
How do I get the value of a seperate bean inside an iterate loop.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found a solution that makes this work. I didn't know you could walk nested properties like a directory.
<nested:iterate property="cList" >
<nested:write property="../../b.id" />
</nested:iterate>
points awarded for explaining JSTL example.
<nested:iterate property="cList" >
<nested:write property="../../b.id" />
</nested:iterate>
points awarded for explaining JSTL example.
ASKER
So, using Struts nested tags, how do I write the contents of an element from the parent array being iterated?