0
我想問你是否可以爲bean的子屬性注入一個值。如何將值注入到bean的子屬性(不帶註釋)?
這是我想做的事情,但是Eclipse IDE與抱怨:
Bean屬性beanB.subprop不是父類paq.paq.BeanA發現
<managed-bean>
<managed-bean-name>beanA</managed-bean-name>
<managed-bean-class>paq.paq.BeanA</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>beanB.subprop</property-name>
<value>Hello!</value>
</managed-property>
</managed-bean>
public class BeanA implements Serializable {
public BeanB beanB = null;
public Skin getBeanB() {
if (this.beanB == null) {
this.beanB = new BeanB();
}
return this.beanB;
}
public void setBeanB(BeanB beanB) {
this.beanB = beanB;
}
}
public class BeanB implements Serializable {
public String subprop = null;
public String getSubprop() {
return this.subprop;
}
public void setSubprop(String subprop) {
this.subprop = subprop;
}
}
謝謝!