O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating a Tree component

Let us see how we can use a Tree component to display PostTitle in a tree structure.

  1. Initialize the root TreeNode component and add child nodes.
    public class TreeController { private TreeNode root; public TreeController() { root = new DefaultTreeNode("Root", null); TreeNode node2013 = new DefaultTreeNode("2013", root); TreeNode node2012 = new DefaultTreeNode("2012", root); TreeNode node2011 = new DefaultTreeNode("2011", root); TreeNode jan2013 = new DefaultTreeNode("Jan", node2013); TreeNode feb2013 = new DefaultTreeNode("Feb", node2013); TreeNode aug2012 = new DefaultTreeNode("Aug", node2012); TreeNode sep2012 = new DefaultTreeNode("Sep", node2012); TreeNode nov2011 = new DefaultTreeNode("Nov", node2011); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required