Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 598173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:21:36+00:00 2026-05-13T16:21:36+00:00

I’ve a rich:tree in my JSF like so: <rich:tree value=#{MyBacking.treeNodes} var=item nodeFace=#{item.type}> <rich:treeNode type=folder

  • 0

I’ve a rich:tree in my JSF like so:

            <rich:tree value="#{MyBacking.treeNodes}" var="item"
                nodeFace="#{item.type}">
                <rich:treeNode type="folder"
                    <h:outputText value="#{item.folder}" />
                </rich:treeNode>
                <rich:treeNode type="file"
                    <h:outputText value="#{item.contfile}" />
                </rich:treeNode>
            </rich:tree>

and the java runtime error

'#{item.type}' Property 'type' not found on type java.lang.String

But I’ve looked at the javadoc for org.richfaces.model.TreeNodeImpl and there’s no mention of a method to assign a type to a tree node. How is this done?

EDIT
I have modified the code as per the supplied answer. Although it feels right, my tree is now being ignored. The java looks like this:

In my backing bean (MyBacking):

public TreeNodeImpl<LogTreeItem> getTreeNodes() {
    TreeNodeImpl<LogTreeItem> rootNode = new TreeNodeImpl<LogTreeItem>();
    LogTreeItem rootItem = new LogTreeItem();
    rootItem.setType("folder");
    rootItem.setName("folderName");
    rootNode.setData(rootItem);

    return rootNode;
}

item class:

public class LogTreeItem {
    private String type; 
    private String name; 

    public String getType() {
        return type;
    }

    public void setType(String t) {
        type = t;
    }

    public String getName() {
        return name;
    }

    public void setName(String n) {
        name = n;
    }
}

JSF snippet thus is now:

            <rich:tree value="#{MyBacking.treeNodes}" var="item" nodeFace="#{item.type}">
                <rich:treeNode type="folder">
                    <h:outputText value="#{item.name}" />
                </rich:treeNode>
            </rich:tree>

All I’m trying to do at this point is get a tree recognised. As I’m only creating a tree with a rootNode, I was expecting a one node tree output, but instead I’m seeing nothing at all. I know I’m close but I just cannot see what tweak would bring it to life.

Thanks a lot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:21:37+00:00Added an answer on May 13, 2026 at 4:21 pm

    It appears that your item is of type String.
    The nodeFace attribute determines which one of the nodes defined below will be rendered for each item.

    You must populate your tree with nodes containing data of your custom type. Let’s say your item looks like this:

    public class Item {
        private String type; //getter+setter
        private String folder; //getter+setter
        private String contfile; //getter+setter
    }
    

    Then treeNodes should actually be rootNode, and must look like this:

    rootNode = new TreeNodeImpl<Item>();
    for (some loop here) {
        TreeNode<Item> node = new TreeNodeImpl<Item>();
        Item item = ..; //get or create the item;
        node.setData(item);
        node.setParent(rootNode);
        rootNode.addChild("someIdentifier", node);
    }
    

    I’d suggest checking out richfaces demo sources to see how it is implemented there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.