Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

jsf - unable to create managed bean primefaces

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

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

1 Reply

0 votes
by (71.8m points)

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. :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...