I wanted to use a bean within another bean. And I wanted the most elegant way to achieve this.
Here’s what I got:
define the beans in the faces-config.xml as follows (notice the color codings, to show references!)
<managed-bean>
<managed-bean-name>childBean</managed-bean-name>
<managed-bean-class>com.abb.xpages.beans.ChildBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>ParentBean</managed-bean-name>
<managed-bean-class>com.abb.xpages.beans.ParentBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>childBeanX</property-name>
<value>#{childBean}</value>
</managed-property>
</managed-bean>
then in your “parentBean” you “inject” the childBean as follows: