Hi,
I often see that beans get injected in one another (as in: the ENTIRE
bean is injected in another bean as a variable), but is this also
possible:
- declare a variable in one bean
- access just this ONE variable from another bean?
So suppose bean A has a variable varA and bean B wishes to access
just this variable.
--> Is smth like the following possible:
<managed-bean>
<managed-bean-name>A</managed-bean-name>
<managed-bean-class>...</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>varA</property-name>
<property-class>java.util.ArrayList</property-class>
<value>? what to put here if the content is not fixed but defined
@ runtime? </value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>B</managed-bean-name>
<managed-bean-class>...</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>beanB_varA</property-name>
<value>#{varA}</value>
</managed-property>
</managed-bean>
... Or does one really have to reference the entire bean and then
perform a getter?
So in this case: reference entire bean A from Bean B and in bean B's
code do beanB_varA = getBeanA().getVarA() ?
Thx,
Wolf