File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Tree in JSF. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Tree in JSF." Watch "Tree in JSF." New topic

Tree in JSF.

Suraj Jallapelli

Joined: May 25, 2008
Posts: 6
Can anyone tell me how to create a tree in JSF.
My other option is to create the same using Myfaces Trnindad.

But i could not find a working example for the same .

Also, my problem is that the tree is getting refreshed for every submit of the form(which is the need), however, i need to bring the tree in the same state as it was before submit. That is, for example, if the user has selected a tree node which is a child of many other tree nodes, then after submit , i need the same tree node to be selected and teh tree should be in the same expanded state as it was before submit.

Thankx in Advance.
Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
I tried using richfaces.

Here is the demo

Here is the example code to keep the tree state across the request.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
Hari Bhangariya

Joined: Jun 04, 2008
Posts: 1
You can create the tree using apache myfaces tomahawk library. It is very simple.
You can see the sample tree at
You can get the code sample at i.e MyFaces Tomahawk 1.1.6 Examples(tar.gz)

I hope this helps

Darryl Nortje
Ranch Hand

Joined: Jun 11, 2002
Posts: 140
Also, about the refreshing problem.. There is a setting.

In tomahawk tree2 component the setting is called "preserveToggle" that you can set to true or false.
I agree. Here's the link:
subject: Tree in JSF.
It's not a secret anymore!