我无法在具有相同范围的另一个井中注入具有范围视图的ManagedBean,是否可能?
示例:
CarBean
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ViewScoped
@ManagedBean(name="carBean")
public class CarBean{}
EngineBean
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ViewScoped
@ManagedBean
public class EngineBean {
@ManagedProperty(value="#{carBean}")
private CarBean carBean;
答案 0 :(得分:0)
是的,不要忘记为carBean添加getter和setter
public CarBean getCarBean(){
return carBean;
}
public void setCarBean(CarBean carBean){
this.carBean = carBean;
}