0

我有 2 个 bean,一个请求范围和 1 个会话范围。我正在尝试通过创建托管属性来访问请求 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>
4

1 回答 1

0

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

于 2013-01-14T21:37:05.390 回答