无法创建托管的bean primefaces [英] unable to create managed bean primefaces

查看:54
本文介绍了无法创建托管的bean primefaces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的managedBean类的代码.我有没有参数的构造函数,setters和getters.仍然我找不到代码的问题.

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.

我也已在faces-config文件中添加了托管bean

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;
   }
}

当我运行xhtml文件时,我将错误抛出为 无法创建托管bean treeBean.发现以下问题:-找不到用于托管bean treeBean的Bean或属性类TreeBean. 我做错了什么?

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?

推荐答案

您已将此@ManagedBean(name = "treeBean")放置在TreeBean管理bean中吗?基于您使用 treeBean 的错误原因.也许为了更安全的代码,请尽量不要在类和方法中使用相似的名称,在您的情况下为TreeBean. :)

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

这篇关于无法创建托管的bean primefaces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆