You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sloan Seaman <sl...@sgi.net> on 2003/07/01 17:21:48 UTC
Nested Tag
I'm trying to do a tree using the nested tags and I'm having some issues.
I've got a NodeBean (like the TreeBean in the monkey bean example) with the following:
public NodeBean() {
key="MonkeyTree";
value="MonkeyTree";
NodeBean n1 = new NodeBean("1", "1");
NodeBean n2 = new NodeBean("2", "2");
NodeBean n3 = new NodeBean("3", "3");
NodeBean n4 = new NodeBean("4", "4");
addChild(n1);
n1.addChild(n3);
addChild(n2);
n2.addChild(n4);
}
And my .jsp looks like:
<nested:form action="/testTree2.do">
<jsp:include page="treeNode.jsp"/>
</nested:form>
and (treeNode.jsp):
<nested:root>
<DL>
<nested:iterate property="children">
<DD><FONT size="-2">
<nested:write property="ancestry">
</FONT>
<nested:writeNesting/>
<jsp:include page="treeNode.jsp"/>
</DD>
</nested:iterate>
</DL>
</nested:root>
But the output I get is:
1 children[0]
3 children[0].children[0]
2 children[1]
3 children[0].children[0]
You can see that node 2 is showing a the child of node 1 when it should (as in the java code) clearly be node 4.
Can anyone help me as to why this is happenning? Is it a bug in the nested tag?
--
Sloan
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________