JSF试图创建托管属性

时间:2013-01-14 20:41:56

标签: java jsf jsf-1.2

我有2个bean,一个请求作用域,一个作用域作用域。我试图通过创建托管属性来访问请求bean中的会话范围bean,但我一直收到错误:

com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean tableBacking.  The following problems were found:
     - Property resultsBacking for managed bean tableBacking does not exist.

这是我的请求范围bean:

public class TableLookupBacking {

    private ResultsBacking resultsBacking;

    public void setResultsBacking(ResultsBacking resultsBacking) {
            this.resultsBacking = resultsBacking;
    }
}

这是我的会话范围bean:

public class ResultsBacking {
    // mainly strings and ints stored in here with getters/setters
}

这是我的faces-config.xml

<managed-bean>
    <managed-bean-name>tableBacking</managed-bean-name>
    <managed-bean-class>backing.TableLookupBacking</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
        <property-name>resultsBacking</property-name>
        <value>#{resultsBacking}</value>
    </managed-property>
</managed-bean>

<managed-bean>
    <managed-bean-name>resultsBacking</managed-bean-name>
    <managed-bean-class>backing.ResultsBacking</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

1 个答案:

答案 0 :(得分:0)

有时JSF会放弃识别我们的支持bean或bean名称中的某些属性,这与 IDE / server / tooling特定问题有关。当发生这种情况并且您已经多次尝试重新部署和清理项目时,重命名类/属性名称可能是一种技巧。之后一切都应该再次起作用。