unable to create managed bean primefaces

折月煮酒 提交于 2019-12-25 18:34:27

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/17873963/unable-to-create-managed-bean-primefaces

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!