I use the following code for building tree:
public class MyBean { public TreeNode getTree(){ TreeNode<T> node = new TreeNodeImpl<T>(); ... node.addChild(mykey, mynode); ... return node; } }
In page:
<rich:tree value="#{mybean.tree}" var="item"> <rich:treeNode> <h:outputText value="#{item}"/> </rich:treeNode> </rich:tree>
Here object denoted by mynode injects to variable item.
Which variable should I use to get access to an object denoted by mykey?
you need to access nodes by keys.. so here is the sample(not sure thata close to your needs) which uses nodes manging by rowKeys. http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?tab=dnd&cid=200762