You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rogerio Pereira <ro...@gmail.com> on 2005/06/16 14:30:02 UTC
Changing a managed property from others managed beans
Hi,
How can i change/access a managed property from any other managed bean.
Thanks for any answer.
Rogério
Re: Changing a managed property from others managed beans
Posted by Duncan Mills <du...@oracle.com>.
Or if you want to access another managed bean at "runtime" so to speak
you can use a method something like this:
public static Object resolveExpression(FacesContext ctx, String
expression)
{
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding(expression);
return bind.getValue(ctx);
}
Enrique Medina wrote:
>Hi,
>
>Why not simply refer to the other bean using Dependency Injection
>through the JSF Managed Bean mechanism?
>
>For example,
>
><managed-bean>
><managed-bean-name>yourInitialBean</managed-bean-name>
><managed-bean-class>com.whatever.you.want.YourInitialBean</managed-bean-class>
><managed-bean-scope>request</managed-bean-scope>
><managed-property>
><property-name>otherManagedBean</property-name>
><value>#{otherManagedBean}</value>
></managed-property>
></managed-bean>
>
>Quique.
>
>2005/6/16, Rogerio Pereira <ro...@gmail.com>:
>
>
>>Hi,
>>
>>How can i change/access a managed property from any other managed bean.
>>
>>Thanks for any answer.
>>
>>Rogério
>>
>>
>>
Re: Changing a managed property from others managed beans
Posted by Enrique Medina <e....@gmail.com>.
Hi,
Why not simply refer to the other bean using Dependency Injection
through the JSF Managed Bean mechanism?
For example,
<managed-bean>
<managed-bean-name>yourInitialBean</managed-bean-name>
<managed-bean-class>com.whatever.you.want.YourInitialBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>otherManagedBean</property-name>
<value>#{otherManagedBean}</value>
</managed-property>
</managed-bean>
Quique.
2005/6/16, Rogerio Pereira <ro...@gmail.com>:
> Hi,
>
> How can i change/access a managed property from any other managed bean.
>
> Thanks for any answer.
>
> Rogério
>