我目前正在为 WAS 7 编写一个简单的 JSF 2 应用程序。当我通过 faces-config.xml 定义 bean 时,一切正常
<managed-bean>
<managed-bean-name>personBean</managed-bean-name>
<managed-bean-class>com.prototype.beans.PersonBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
当我尝试改用下面的注释时,应用程序失败。
package com.prototype.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean(name="personBean")
@RequestScoped
public class PersonBean {
....
}
我已将 WAS 类加载器设置为 Parent Last,并在日志中验证 Mojarra 2.x 正在加载。
[5/17/10 10:46:59:399 CDT] 00000009 config I Initializing Mojarra 2.0.2 (FCS b10) for context '/JSFPrototype'
但是,当我尝试使用该应用程序(使用基于 XML 的配置)时,我看到以下内容
[5/17/10 10:48:08:491 CDT] 00000016 lifecycle W /pages/inputname.jsp(16,7) '#{personBean.personName}' Target Unreachable, identifier 'personBean' resolved to null
org.apache.jasper.el.JspPropertyNotFoundException: /pages/inputname.jsp(16,7) '#{personBean.personName}' Target Unreachable, identifier 'personBean' resolved to null
有谁知道出了什么问题?