You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Pierandrea Cercato <ce...@gmail.com> on 2009/01/15 16:23:35 UTC

Retrive through uicomponent binding backing bean object

I have an HtmlInputTextArea. It has as value a property of an object of an
arrayList.

<h:inputTextarea  cols="30" binding="#{translationsBean.inputCountry}"
immediate="false" value="#{translation.localTranslation}">

Is it possible *through binding* of the component...

public HtmlInputTextarea getInputCountry() {
        return inputCountry;
    }

    public void setInputCountry(HtmlInputTextarea inputCountry) {
        this.inputCountry = inputCountry;
    }

to retrieve at runtime the corresponding backed object. Something like:

inputCountry.getBackingBeanObject




Thanks

Re: Retrive through uicomponent binding backing bean object

Posted by Simon Lessard <si...@gmail.com>.
Hi,

May I inquire what your use case is? There's a way to do it, but it's very,
very funky:

1. ValueExpression valueExpr = component.getValueExpression("value");
2. String expressionString = valueExpr.getExpressionString();
3. Parse the string the remove the last element of the EL
4. Recreate a ValueExpression object with the modified String
5. Evaluate the ValueExpression

As you see, it's complex and providing us with your real use case would
allow me to give you a better alternative.


Regards,

~ Simon

On Thu, Jan 15, 2009 at 10:23 AM, Pierandrea Cercato <ce...@gmail.com>wrote:

> I have an HtmlInputTextArea. It has as value a property of an object of an
> arrayList.
>
> <h:inputTextarea  cols="30" binding="#{translationsBean.inputCountry}"
> immediate="false" value="#{translation.localTranslation}">
>
> Is it possible *through binding* of the component...
>
> public HtmlInputTextarea getInputCountry() {
>         return inputCountry;
>     }
>
>     public void setInputCountry(HtmlInputTextarea inputCountry) {
>         this.inputCountry = inputCountry;
>     }
>
> to retrieve at runtime the corresponding backed object. Something like:
>
> inputCountry.getBackingBeanObject
>
>
>
>
> Thanks
>