2011-05-12 66 views

回答

0

請參閱this example from the Primefaces展示。

你可以使用一個選擇監聽器,並從後臺bean的方法重定向:

<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> 

,並在bean:

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