Page 1 of 1

use p:Tree for navigation

Posted: 17 Dec 2010, 12:59
by nirvanbd
Hi,
I was trying to figure out how I would use p:tree to handle navigation. Basically, I wan't to use the tree as a menu in left side on my page. I was trying to use something like this in my code but I get an error. The data for the p:tree is populated in treeMenuBean (JSF Managed Session Bean).

Code: Select all

    <p:tree value="#{treeMenuBean.root}" var="node">
        <p:treeNode>
            <h:outputLink value="#{node.data}">
                <h:outputLabel value="node"/>
            </h:outputLink>
        </p:treeNode>
    </p:tree>
Here is the error I get

Code: Select all

/public/treeMenu.xhtml @6,48 value="#{node.data}": The class 'java.lang.String' does not have the property 'data'.
I am setting node.setData("/myPage.xhtml") in the treeMenuBean, but unable to retrieve it in the xhtml page in p:treeNode as a property of node variable.
If anyone has sucessfully used the p:Tree with outputLink, please post the example code.

regards,
Nirvan.