0
在我JSF2-Primefaces3 web應用中,我引用來自豆名爲「HomeBean」豆「CityBean」我使用ManagedBean註釋和沒有faces-config.xml中都得到ManagedBeanCreationException。請找到的代碼如下:注入託管bean時爲其他
HomeBean
@ManagedBean(name="HmBen")
@SessionScoped
public class HomeBean implements Serializable {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(HomeBean.class);
private List<Offer> offersList;
public HomeBean() {
}
}
CityBean
@ManagedBean(name="CtyBen")
@SessionScoped
public class CityBean implements Serializable {
private static final long serialVersionUID = 1L;
@ManagedProperty(value="#{HmBen}")
private HomeBean homeBean;
public CityBean() {
}
/**
* Following setters are required as per the documentation for Dependancy
* Injection of beans to work
*/
public void setHomeBean(HomeBean homeBean) {
this.homeBean = homeBean;
}
}
注意:這只是一個由於施加#2字符限制的代碼段。
我得到以下異常:
Caused by: com.sun.faces.mgbean.ManagedBeanCreationException: Unable to set property homeBean for managed bean CtyBen
at com.sun.faces.mgbean.ManagedBeanBuilder$BakedBeanProperty.set(ManagedBeanBuilder.java:615)
at com.sun.faces.mgbean.ManagedBeanBuilder.buildBean(ManagedBeanBuilder.java:133)
... 20 more
Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2377)
有沒有人有這方面有任何線索?