2012-10-08 4 views
2

<p:tree>을 사용하고 있습니다. <p:ajax>을 사용하여 선택된 노드를 감지하고 조치를 취하려고합니다.<p:ajax> 내부 사용 방법 <p:tree> primefaces?

<p:tree id="treeDot" value="#{beanRequest.rootDot}" var="node" selectionMode="single" 
    nodeSelectListener="#{beanRequest.clt}" > 
    <p:ajax event="select" listener="#{beanRequest.clientSelected}" /> 
     <p:treeNode> 
      <h:outputText value="#{node}" /> 
     </p:treeNode> 
</p:tree> 

서버 측 방법 :

//... 
private Client clt; 
public void clientSelected(NodeSelectEvent event) { 
    //... 
} 
//... 

나는 다음과 같은 예외를 얻을 :

8 oct. 2012 17:30:01 com.sun.faces.context.PartialViewContextImpl processPartial 
INFO: java.lang.NullPointerException 
java.lang.NullPointerException 
    at org.primefaces.component.api.UITree.findTreeNode(UITree.java:111) 
    at org.primefaces.component.api.UITree.setRowKey(UITree.java:78) 
    at org.primefaces.component.tree.TreeRenderer.decodeSelection(TreeRenderer.java:62) 
    at org.primefaces.component.tree.TreeRenderer.decode(TreeRenderer.java:38) 
    at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787) 
    at org.primefaces.component.api.UITree.processDecodes(UITree.java:170) 
    at org.primefaces.component.tree.Tree.processDecodes(Tree.java:366) 
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506 
) 
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) 
    at org.primefaces.component.api.UITree.visitTree(UITree.java:392) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at org.primefaces.component.tabview.TabView.visitTree(TabView.java:400) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 
    at javax.faces.component.UIForm.visitTree(UIForm.java:371) 
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) 

답변

0

내가 실수를 발견이 내 실제 JSF 코드입니다. 단지 selection="#{beanRequest.selectedNode}" 에 의해 nodeSelectListener="#{beanRequest.clt}"를 교체하고 사용 된 Primefaces이 private TreeNode selectedNode;

+0

어떤 버전의 같은 beanRequest에서 selecttedNode 변수를 생성? – Ghasfarost

+0

@Ghasfarost 3.4.2를 사용 중입니다. –

관련 문제