JSF试图创建一个托管属性



我有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>

有时JSF会放弃识别支持bean或bean本身名称中的某些属性,这与IDE/服务器/工具特定的问题有关。如果发生这种情况,并且您已经多次尝试重新部署和清理项目,那么重命名类/属性名称可能是一个技巧。之后,一切都会恢复正常。

相关内容

  • 没有找到相关文章

最新更新