10 Replies Latest reply on Feb 10, 2014 7:59 AM by Matija Vizintin

    <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property

    Tiago Freire Newbie

      I'm testing the component <rich:tree> using RichFaces 4.2.2.Final and I can't capture the selected nodes in the tree. I'm using the <rich:tree> attribute selection="#{treeBean.selected}" to save the selected set of nodes on that property, according to the API must be of type HashSet to accept multiple selection. As I understand it, the selectionType="ajax" in conjunction with selection="#{treeBean.selected}" would make this property "selected" to be populated in managed-bean, causing the render="showSelected" do the corresponding <a4j:outputPanel> to be re-rendered, showing the selected node. Unfortunately, it's not what happens. I would be grateful if someone could give some suggestion.

       

      Here's the relevant code:

       

      XHTML Page:

      <h:form id="formTree">
      
                <rich:tree id="tree" value="#{treeBean.root}" var="node" nodeType="#{node.type}" toggleType="client"
                          style="width: 500px" selectionType="ajax" selection="#{treeBean.selected}" render="showSelected">
      
                          <rich:treeNode type="leaf">
                                    <h:outputText value="#{node}" />
                          </rich:treeNode>
      
                          <rich:treeNode type="branch">
                                    <h:outputText value="#{node}" />
                          </rich:treeNode>
      
                </rich:tree>
      
                <a4j:outputPanel id="showSelected" layout="block">
                          <h:outputText value="#{treeBean.singleSelected}" rendered="#{not empty treeBean.selected}" />
                </a4j:outputPanel>
      
      </h:form>
      

       

      Managed-bean:

      @ManagedBean
      @SessionScoped
      public class TreeBean {
                private TreeElement<String> root;
      
                private HashSet<TreeElement<String>> selected;
      
                public TreeBean() {
                          if(root == null) {
                                    TreeElement<String> branch = new TreeElement<String>(false, "First branch");
      
                                    for(int i = 0; i < 5; i++) {
                                              TreeElement<String> leaf = new TreeElement<String>(true, "Leaf " + (i + 1));
                                              branch.addChild(i, leaf);
                                    }
      
                                    root = new TreeElement<String>();
                                    root.addChild(0, branch);
                                    root.addChild(1, new TreeElement<String>(false, "Second branch"));
                                    root.addChild(2, new TreeElement<String>(true, "Leaf directly linked to the root"));
                          }
                }
      
                public TreeElement<String> getRoot() {
                          return root;
                }
      
                public HashSet<TreeElement<String>> getSelected() {
                          return selected;
                }
      
                public void setSelected(HashSet<TreeElement<String>> selected) {
                          this.selected = selected;
                }
      
                public TreeElement<String> getSingleSelected() {
                          if(!selected.isEmpty()) {
                                    return selected.iterator().next();
                          }
      
                          return null;
                }
      }
      

       

      TreeElement class:

      public class TreeElement<T> extends org.richfaces.model.TreeNodeImpl {
      
                private T data;
                private String type;
      
                public TreeElement() {
                          super();
                }
      
                public TreeElement(boolean leaf, T data) {
                          super(leaf);
                          this.data = data;
                          this.type = leaf ? "leaf" : "branch";
                }
      
                public T getData() {
                          return data;
                }
      
                public void setData(T data) {
                          this.data = data;
                }
      
                public String getType() {
                          return type;
                }
      
                public void setType(String type) {
                          this.type = type;
                }
      
                @Override
                public String toString() {
                          return this.data.toString();
                }
      }
      

       

       

        • 2. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
          Nicolás Carrasco Newbie

          Try using selectionChangeListener instead of selection.

           

          public void selectionChanged(TreeSelectionChangeEvent selectionChangeEvent) {
             
              List<Object> selection = new ArrayList<Object>(selectionChangeEvent.getNewSelection());
              Object currentSelectionKey = selection.get(0);
              UITree tree = (UITree) selectionChangeEvent.getSource();
              tree.setRowKey(currentSelectionKey);
             
              Object rowData = tree.getRowData();
              if (rowData instanceof  TreeElement<String> ) ....
          • 3. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
            Tiago Freire Newbie

            I added the attribute selectionChangeListener="{treeBean.selectionChanged}" and I created the method selectionChanged(TreeSelectionChangeEvent selectionChangeEvent), as your orientation, but the method is not even running...

             

            My updated code:

             

            XHTML page:

            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            
            
            <html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:a4j="http://richfaces.org/a4j">
            
            
            <ui:composition>
                
              <f:view contentType="text/html">
            
              <h:head>
              <title>RichFaces Test</title>
            
              <h:outputStylesheet>
              .tree-node-dragging { font: 10px arial; }
              .tree-node-accept { color: green; }
              .tree-node-reject { color: red; }
              </h:outputStylesheet>
              </h:head>
            
              <h:body>
              <h:form id="treeForm">
            
              <rich:tree id="tree" value="#{treeBean.root}" var="node" nodeType="#{node.type}" toggleType="client"
              selectionType="ajax" selectionChangeListener="#{treeBean.selectionChanged}"
              style="width: 300px">
            
              <rich:treeNode type="leaf">
              <h:outputText value="#{node}" />
              </rich:treeNode>
            
              <rich:treeNode type="branch">
              <h:outputText value="#{node}" />
              </rich:treeNode>
            
              </rich:tree>
            
              <a4j:outputPanel ajaxRendered="true" id="showElement">
              <h:outputText value="#{treeBean.selected}" rendered="#{not empty treeBean.selected}" />
              </a4j:outputPanel>
            
              </h:form>
            
              </h:body>
            
              </f:view>
              
            </ui:composition>
            
            </html>
            

             

             

            Managed-bean:

            @ManagedBean
            @ViewScoped
            public class TreeBean {
            
              private TreeElement<String> root;
            
              private TreeElement<String> selected;
            
              public TreeBean() {
              if(root == null) {
              TreeElement<String> branch = new TreeElement<String>(false, "First branch");
            
              for(int i = 0; i < 5; i++) {
              TreeElement<String> leaf = new TreeElement<String>(true, "leaf " + (i + 1));
              branch.addChild(i, leaf);
              }
            
              root = new TreeElement<String>();
              root.addChild(0, ramo);
              root.addChild(1, new TreeElement<String>(false, "Second branch"));
              root.addChild(2, new TreeElement<String>(true, "Leaf directly linked to the root"));
              }
              }
            
            
              public TreeElement<String> getRoot() {
              return root;
              }
            
            
              public TreeElement<String> getSelected() {
              return selected;
              }
            
            
              public void setSelected(TreeElement<String> selected) {
              this.selected = selected;
              }
            
              public void selectionChanged(TreeSelectionChangeEvent selectionChangeEvent) {
              System.out.println("some node selected!!");
              List<Object> selection = new ArrayList<Object>(selectionChangeEvent.getNewSelection());
              Object currentSelectionKey = selection.get(0);
              UITree tree = (UITree) selectionChangeEvent.getSource();
              tree.setRowKey(currentSelectionKey);
              }
            }
            
            • 4. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
              Tiago Freire Newbie

              using a requests monitoring tool, like chrome's console or firebug on firefox, it's possible to view the requests being triggered when you click on the tree nodes, but the managed-bean method it isn't executed...

              • 5. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
                Tiago Freire Newbie

                I tested a toggle listener - toggleListener="#{treeBean.toggleChanged}" - and it works fine, but a selectionChangeListener doesn't work... it seems there are bugs on selection listener. i'm going to try using pure jquery to handle my problem...

                • 6. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
                  Tiago Freire Newbie

                  all my problems were solved a few days ago, when i put rowKeyConverter="org.richfaces.IntegerSequenceRowKeyConverter" in <rich:tree>!

                  the rowKeyConverter attribute isn't well explained in documentation...

                  • 7. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
                    Steve Roderick Newbie

                    Tiago,

                     

                    I am attempting to get the tree to work the same way you did. Could you post your working code ( I assume it is similar to your first post but with the rowKeyConverter piece added). I couldn't get the selectionChangeListener to work at all when I used a tree bean as the tree source, instead I had to use a rich:treeModelRecursiveAdaptor with a collection as its source, but now I can't get the selected attribute to work.

                     

                    Thanks,

                     

                    Steve

                    • 8. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
                      Tiago Freire Newbie

                      Basically, the only relevant change was the rowKeyConverter piece added... I haven't worked yet with rich:treeModelRecursiveAdaptor.

                      • 9. Re: Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
                        Damon Chong Newbie

                        This is a bit late but you can try placing selectionChangeListener at the level of

                        <rich:tree>

                        if you are using rich:treeModelRecursiveAdaptor. You don't really need to use rowKeyConverter either.

                        • 10. Re: <rich:tree> in RichFaces 4.2.2.Final without associating the selected node(s) with managed-bean property
                          Matija Vizintin Newbie

                          I'm having kind of a similar problem with tree selection. I've created a small project with jboss as 7.1.4, mojarra 2.2.1 and RF 4.3.5.

                           

                          Node:

                          public class TreeNode extends TreeNodeImpl {
                              public String data;
                              public String type = "NODE";
                          
                          
                              public TreeNode() {
                              }
                          
                          
                              public TreeNode(String data) {
                                  this.data = data;
                              }
                          
                          
                              public TreeNode(boolean leaf, String data) {
                                  super(leaf);
                                  if (leaf) {
                                      type = "LEAF";
                                  }
                                  this.data = data;
                              }
                          
                          
                              public String getData() {
                                  return data;
                              }
                          
                          
                              public void setData(String data) {
                                  this.data = data;
                              }
                          
                          
                              public String getType() {
                                  return type;
                              }
                          
                          
                              public void setType(String type) {
                                  this.type = type;
                              }
                          }
                          
                          
                          

                           

                          Backing bean:

                          @ManagedBean
                          @SessionScoped
                          public class TreeBean implements Serializable {
                          
                          
                              public TreeNode getTree() {
                                  TreeNode root = new TreeNode();
                                  TreeNode child = new TreeNode("child 1");
                                  TreeNode subChild = new TreeNode(true, "subchild 1");
                                  child.addChild(0, subChild);
                                  subChild = new TreeNode(true, "subchild 2");
                                  child.addChild(1, subChild);
                                  root.addChild(0, child);
                                  child = new TreeNode("child 2");
                                  subChild = new TreeNode(true, "subchild 3");
                                  child.addChild(0, subChild);
                                  subChild = new TreeNode(true, "subchild 4");
                                  child.addChild(1, subChild);
                                  root.addChild(1, child);
                                  child = new TreeNode("child 3");
                                  root.addChild(2, child);
                                  return root;
                              }
                          
                          
                              public void selectionChanged(TreeSelectionChangeEvent selectionChangeEvent) {
                                  System.out.println("selectionChangeEvent = " + selectionChangeEvent);
                              }
                          }
                          
                          
                          

                           

                          xhtml:

                          <?xml version="1.0" encoding="UTF-8"?>
                          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                          <html xmlns="http://www.w3.org/1999/xhtml"
                                xmlns:h="http://java.sun.com/jsf/html"
                                xmlns:rich="http://richfaces.org/rich"
                                xmlns:a4j="http://richfaces.org/a4j">
                          
                          
                          <h:head>
                              <title>RF Hello World</title>
                          </h:head>
                          <h:body>
                              <h3>RF Hello World</h3>
                              <h:form>
                          
                                  <rich:tree id="tree" value="#{treeBean.tree}" var="node" toggleType="client"
                                             selectionType="ajax" selectionChangeListener="#{treeBean.selectionChanged}" nodeType="#{node.type}">
                                      <rich:treeNode type="NODE">
                                          <h:outputText value="NODE: #{node.data}" />
                                      </rich:treeNode>
                                      <rich:treeNode type="LEAF">
                                          <h:outputText value="LEAF: #{node.data}" />
                                      </rich:treeNode>
                                  </rich:tree>
                                  <br/>
                                  <a4j:commandLink value="refresh" render="tree, randomNumber" limitRender="true" />
                                  <br></br>
                                  <h:outputText value="#{helloBean.randomNumber()}" id="randomNumber" />
                              </h:form>
                          </h:body>
                          </html>
                          
                          
                          

                           

                          If I select any node, nothing happens and I get this error:

                          13:43:45,848 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-/0.0.0.0:8080-4) JSF1007: Duplicate component ID j_idt6:tree:j_idt10 found in view.
                          13:43:45,848 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-/0.0.0.0:8080-4) +id: j_id1
                          type: javax.faces.component.UIViewRoot@26c94ab9
                            +id: javax_faces_location_HEAD
                             type: com.sun.faces.component.ComponentResourceContainer@5d90f7e6
                              +id: __rf_skinning_resource
                               type: javax.faces.component.UIOutput@58834d07
                              +id: j_id2
                               type: javax.faces.component.UIOutput@143633f7
                              +id: j_id3
                               type: javax.faces.component.UIOutput@728da77e
                              +id: j_id4
                               type: javax.faces.component.UIOutput@31ef7bf3
                              +id: j_id5
                               type: javax.faces.component.UIOutput@61b2a821
                              +id: j_id6
                               type: javax.faces.component.UIOutput@183c40a3
                              +id: j_id7
                               type: javax.faces.component.UIOutput@1bb799c3
                              +id: j_id8
                               type: javax.faces.component.UIOutput@32cfdf6c
                              +id: j_id9
                               type: javax.faces.component.UIOutput@6d554583
                            +id: j_idt1
                             type: <html xmlns="http://www.w3.org/1999/xhtml">
                          
                          
                          
                          
                            +id: j_idt2
                             type: javax.faces.component.UIOutput@6948cb93
                              +id: j_idt3
                               type:
                              <title>RF Hello World</title>
                          
                          
                            +id: j_idt4
                             type: javax.faces.component.UIOutput@6624305
                              +id: j_idt5
                               type:
                              <h3>RF Hello World</h3>
                            
                              +id: j_idt6
                               type: javax.faces.component.html.HtmlForm@1d1e0089
                                +id: j_idt7
                                 type: javax.faces.component.html.HtmlInputText@1cb5314e
                                +id: j_idt8
                                 type: javax.faces.component.html.HtmlCommandButton@3bb8069b
                                +id: j_idt9
                                 type:
                          
                          
                                  <br/><br/>
                                
                                +id: tree
                                 type: org.richfaces.component.UITree@2eb9c8be
                                  +id: __defaultTreeNode
                                   type: org.richfaces.component.UITreeNode@7946d388
                                    +id: j_id3
                                     type: javax.faces.component.html.HtmlOutputText@18e9c3ec
                                  +id: j_idt10
                                   type: org.richfaces.component.UITreeNode@1b3dc7bb
                                    +id: j_idt11
                                     type: javax.faces.component.html.HtmlOutputText@7503d3f5
                                  +id: j_idt12
                                   type: org.richfaces.component.UITreeNode@4e50b5d7
                                    +id: j_idt13
                                     type: javax.faces.component.html.HtmlOutputText@14d25e6c
                                  +id: j_idt10
                                   type: org.richfaces.component.UITreeNode@272a49e9
                                    +id: j_idt11
                                     type: javax.faces.component.html.HtmlOutputText@495a7415
                                  +id: j_idt12
                                   type: org.richfaces.component.UITreeNode@517b3452
                                    +id: j_idt13
                                     type: javax.faces.component.html.HtmlOutputText@6fa81d48
                                +id: j_idt14
                                 type:
                                  <br/>
                                
                                +id: j_idt15
                                 type: org.richfaces.component.UICommandLink@61a9b3d
                                +id: j_idt16
                                 type:
                                  <br/>
                                
                                +id: randomNumber
                                 type: javax.faces.component.html.HtmlOutputText@3cc5c4ec
                            +id: j_idt17
                             type:
                          
                          
                          </html>
                          
                          
                          13:43:45,848 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-/0.0.0.0:8080-4) Error Rendering View[/index.xhtml]: java.lang.IllegalStateException: Component ID j_idt6:tree:j_idt10 has already been found in the view.
                            at com.sun.faces.util.Util.checkIdUniqueness(Util.java:832) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.util.Util.checkIdUniqueness(Util.java:816) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.util.Util.checkIdUniqueness(Util.java:816) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.util.Util.checkIdUniqueness(Util.java:816) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.application.view.FaceletFullStateManagementStrategy.saveView(FaceletFullStateManagementStrategy.java:686) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:89) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at javax.faces.application.StateManager.getViewState(StateManager.java:553) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at org.richfaces.context.ExtendedPartialViewContextImpl.renderState(ExtendedPartialViewContextImpl.java:416) [richfaces-core-impl-4.3.5.Final.jar:4.3.5.Final]
                            at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:313) [richfaces-core-impl-4.3.5.Final.jar:4.3.5.Final]
                            at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:213) [richfaces-core-impl-4.3.5.Final.jar:4.3.5.Final]
                            at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:979) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:411) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
                            at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.1.4.Final-SNAPSHOT.jar:7.1.4.Final-SNAPSHOT]
                            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
                            at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
                            at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
                          
                          
                          13:43:45,850 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jsf_test_war_exploded].[Faces Servlet]] (http-/0.0.0.0:8080-4) Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalStateException: CDATA tags may not nest
                            at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.startCDATA(HtmlResponseWriter.java:664) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at javax.faces.context.ResponseWriterWrapper.startCDATA(ResponseWriterWrapper.java:172) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at javax.faces.context.PartialResponseWriter.startError(PartialResponseWriter.java:342) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at org.richfaces.context.PartialResponseWriterWrapper.startError(PartialResponseWriterWrapper.java:116) [richfaces-core-impl-4.3.5.Final.jar:4.3.5.Final]
                            at org.richfaces.context.DeferredEndingPartialResponseWriter.startError(DeferredEndingPartialResponseWriter.java:75) [richfaces-core-impl-4.3.5.Final.jar:4.3.5.Final]
                            at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:200) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:124) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.16-jbossorg-1.jar:]
                            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
                            at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.1.4.Final-SNAPSHOT.jar:7.1.4.Final-SNAPSHOT]
                            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
                            at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
                            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
                            at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
                          
                          
                          
                          

                           

                          If I click on refresh link, which is under the tree just for testing purposes, the first time everything works fine, the second time the same error is thrown.

                           

                          I really don't understand what's wrong. It look like there is also some kind of problem with nodeType attribute, because when I remove noteType from rich:tree it doesn't throw any exceptions but neither the selectionChanged method is invoked.