开发者

Link a treenode(Primefaces) to an xhtml page

开发者 https://www.devze.com 2023-03-05 21:50 出处:网络
i have created the tree with its nodes and i would l开发者_如何学运维ike to put an action on each node to move it to an xhtml form say(ManageUser.xhtml) when i click on the node(say Manage User). See

i have created the tree with its nodes and i would l开发者_如何学运维ike to put an action on each node to move it to an xhtml form say(ManageUser.xhtml) when i click on the node(say Manage User).


See this example from the Primefaces showcase.

You could use a select listener and redirect from the backing bean method:

<p:tree value="#{treeBean.root}" var="node"  
            selectionMode="single"  
            selection="#{treeBean.selectedNode}"  
            nodeSelectListener="#{treeBean.onNodeSelect}">  
        <p:treeNode>  
            <h:outputText value="#{node}" />  
        </p:treeNode>  
</p:tree>

and in the bean:

public void onNodeSelect(NodeSelectEvent event) {  
        FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", event.getTreeNode().getData().toString());  
        // redirect here
}  
0

精彩评论

暂无评论...
验证码 换一张
取 消