Y
yzzzzz
Hi,
I have this interface:
public interface A {
public String getTitle();
public List<A> getChildren();
}
I have an object of type A (root), which has children of type A, who
themselves have children, and so on.
In my JSP I would like do display a tree, e.g.
${root.title}
<ul>
<c:forEach items="${root.children}" var="element">
<li>${element.title}
<ul>
<c:forEach items="${element.children}" var="element2">
<li>${element2.title}
<ul>
<c:forEach items="${element2.children}" var="element3">
*** etc. ***
</c:forEach>
</ul>
</li>
</c:forEach>
</ul>
</li>
</c:forEach>
</ul>
Here I only have 3 levels of recursion. I need to display the whole
tree. Is there a way of doing this?
Thanks.
I have this interface:
public interface A {
public String getTitle();
public List<A> getChildren();
}
I have an object of type A (root), which has children of type A, who
themselves have children, and so on.
In my JSP I would like do display a tree, e.g.
${root.title}
<ul>
<c:forEach items="${root.children}" var="element">
<li>${element.title}
<ul>
<c:forEach items="${element.children}" var="element2">
<li>${element2.title}
<ul>
<c:forEach items="${element2.children}" var="element3">
*** etc. ***
</c:forEach>
</ul>
</li>
</c:forEach>
</ul>
</li>
</c:forEach>
</ul>
Here I only have 3 levels of recursion. I need to display the whole
tree. Is there a way of doing this?
Thanks.