wood burning stoves 2.0*
The moose likes JSF and the fly likes <rich:tree> and database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "<rich:tree> and database" Watch "<rich:tree> and database" New topic
Author

<rich:tree> and database

Mladen Stupar
Greenhorn

Joined: Oct 14, 2009
Posts: 3
Is it possible to fill the <rich:tree> component nodes, with data from the database?

I have a table "Categories" in the database with two columns: "id_category" and "name_category". In treeBean class I have a method:
Below this I have "get" and "set" methods.

My JSF code for <rich:tree> component looks like this:
But this, in this way doesn't work. I get the following error message:
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15629
    
  15

You can. I do. However, you can't simply point the tree at the data, you need a treemodel wrapper just like you need a databtable model wrapper. They both help maintain the UI-specific context.

Check the RichFaces docs. In recent releases, they added a way to easily wrap things such as domain model objects so you don't actually need to construct a tree-specific data model.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <rich:tree> and database
 
Similar Threads
Trying to get layout worked out for three content panes (using facelets template)
Problem getting richfaces tree to display
Need my rich:tree to be re loaded when I add a new entity to it
problem JSF - datatable from DB
richface tree example