Meaningless Drivel is fun!*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Tree in JSF." Watch "Tree in JSF." New topic
Author

Tree in JSF.

Suraj Jallapelli
Greenhorn

Joined: May 25, 2008
Posts: 6
Hi,
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
http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf

Here is the example code to keep the tree state across the request.
http://jboss.com/index.html?module=bb&op=viewtopic&t=126153


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

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 http://www.irian.at/myfacesexamples/home.jsf
You can get the code sample at i.e MyFaces Tomahawk 1.1.6 Examples(tar.gz)
from http://myfaces.apache.org/download.html.

I hope this helps


SCJP SCWCD 5.0
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tree in JSF.
 
Similar Threads
Can anyone explain the function of CellEditor getCellEditorValue() please
my-faces - how to change tree2 hierarchy?
JTree Refresh
help needed on tree menu
Event on selecing the same node in a JTree