Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

this is the code of my managedBean class. i have no-arg constructor, setters and getters. still i'm unable to find what is wrong with the code.

i have added the managed bean in the faces-config file as well

public class TreeBean {

  private TreeNode root;

    public void setRoot(TreeNode root) {
        this.root = root;
    }
<!--this is the no arg constructor.--!>
the setters and getters are also set accordingly.
   public TreeBean() {
      root = new DefaultTreeNode("Root", null);
      TreeNode node0 = new DefaultTreeNode("Node 0", root); 
   }

   public TreeNode getRoot() {
      return root;
   }
}

when i run the xhtml file i throws the error as Unable to create managed bean treeBean. The following problems were found: - Bean or property class TreeBean for managed bean treeBean cannot be found. what wrong have i done?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
164 views
Welcome To Ask or Share your Answers For Others

1 Answer

Have you placed this @ManagedBean(name = "treeBean") in your TreeBean manage bean? cause base on the error you use treeBean. And maybe for safer code, try not to use similar name in your class and method, which in your case is the TreeBean. :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...