File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "<rich:tree> and database" Watch "<rich:tree> and database" New topic

<rich:tree> and database

Mladen Stupar

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: 17423

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: <rich:tree> and database
It's not a secret anymore!