Wolf Benz wrote:
Thanks but... this is what I knew so far :-)
What I want is not sharing an ENTIRE bean, just ONE variable. (a managed property)
Is this possible as well?

Thought of these 2 possibilities: (donno whether it would work/ whether at least one of them is correct)

<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>
 <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>


Hello Wolf,

I thing the first method should work, but! This will almost sure set the property while instantiating the session bean. It means that those beans will share one instance. When you use still the same instance it will be all right. When you change the instance in A it won't be shared with B any more. B will still have the old instance. That's my opinion.

This would mean that sharing int, boolean or other scalar type variables would never work this way.

Best regards

Ondrej Svetlik

Reply via email to