title: primefaces tree displays a list
body: <p>I've copied the XHTML and the managed bean code from the primefaces multiple selection tree showcase page (for the basic tree showcase I've got the same result too).</p>
  
  <p>Here is my <code>index.xhtml</code>: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h:form id="form"&gt;
  
          &lt;p:growl id="messages" showDetail="true" escape="false" /&gt;
  
          &lt;p:tree value="#{treeBean.root}" var="node" selectionMode="multiple"
              selection="#{treeBean.selectedNodes}" id="treeMultiple"&gt;
  
              &lt;p:treeNode&gt;
                  &lt;h:outputText value="#{node}" /&gt;
              &lt;/p:treeNode&gt;
          &lt;/p:tree&gt;
  
          &lt;p:commandButton value="Display Selected" update="messages"
              actionListener="#{treeBean.displaySelectedMultiple}" id="btnDisplay" /&gt;
  
      &lt;/h:form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and here is the bean: </p>
  
  <pre><code>package org.primefaces.examples.view;
  
  import java.io.Serializable;
  
  import javax.faces.application.FacesMessage;
  import javax.faces.bean.ManagedBean;
  import javax.faces.context.FacesContext;
  import javax.faces.event.ActionEvent;
  
  import org.primefaces.model.DefaultTreeNode;
  import org.primefaces.model.TreeNode;
  
  @ManagedBean
  public class TreeBean implements Serializable {
  
      private TreeNode root;
  
      private TreeNode[] selectedNodes;
  
      public TreeBean() {
          root = new DefaultTreeNode("Root", null);
          TreeNode node0 = new DefaultTreeNode("Node 0", root);
          TreeNode node1 = new DefaultTreeNode("Node 1", root);
          TreeNode node2 = new DefaultTreeNode("Node 2", root);
  
          TreeNode node00 = new DefaultTreeNode("Node 0.0", node0);
          TreeNode node01 = new DefaultTreeNode("Node 0.1", node0);
  
          TreeNode node10 = new DefaultTreeNode("Node 1.0", node1);
          TreeNode node11 = new DefaultTreeNode("Node 1.1", node1);
  
          TreeNode node000 = new DefaultTreeNode("Node 0.0.0", node00);
          TreeNode node001 = new DefaultTreeNode("Node 0.0.1", node00);
          TreeNode node010 = new DefaultTreeNode("Node 0.1.0", node01);
  
          TreeNode node100 = new DefaultTreeNode("Node 1.0.0", node10);
      }
  
      public TreeNode getRoot() {
          return root;
      }
  
      public TreeNode[] getSelectedNodes() {
          return selectedNodes;
      }
  
      public void setSelectedNodes(TreeNode[] selectedNodes) {
          this.selectedNodes = selectedNodes;
      }
  
      public void displaySelectedMultiple(ActionEvent event) {
               if(selectedNodes != null &amp;&amp; selectedNodes.length &gt; 0) {
                   StringBuilder builder = new StringBuilder();
  
              for(TreeNode node : selectedNodes) {
                  builder.append(node.getData().toString());
                  builder.append("&lt;br /&gt;");
              }
  
  
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected",builder.toString());
  
              FacesContext.getCurrentInstance().addMessage(null, message);
          }
      }
  }
  </code></pre>
  
  <p>and all I got was something like a simple list:</p>
  
  <blockquote>
    <p>• Node 0<br>
    • Node 1<br>
    • Node 2</p>
  </blockquote>
  
  <p>it looks like Ajax, CSS or/and JavaScript code is missing... but it's not mentioned to add that in the showcase.
  Thanks for the help!</p>
  
  <p>tomcat 7
  eclipse juno
  webapp configuration: 
  jsf 2.1
  dynamic webapp 3.0
  java 6</p>