Wolf Benz wrote:
Hi,
Short question: (thought of another solution)

Is this the proper way of passing just one variable from one backing bean to another, or is there a better way? (I'd just like to avoid sharing the entire bean, which you usually see)
So if e.g.
- bean A has varA
- bean B wants to access just this ONE variable from bean A


--> Is this correct? (or is there a better/proper way)

    <managed-bean>
        <managed-bean-name>A</managed-bean-name>
        <managed-bean-class>...</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
<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> <!-- Name of the very same var in bean B--> <value>#{beanA.varA}</value> <!-- referencing this way allowed?-->
        </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

Hello,

this should help you:

http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother

Best regards

Ondrej Svetlik

Reply via email to