JSF 1.2 code:

CoreInputText childComponent;
  childComponent = (CoreInputText)
application.createComponent(CoreInputText.COMPONENT_TYPE);
FacesContext facesContext = FacesContext.getCurrentInstance();
ValueExpression ve = facesContext.getApplication().getExpressionFactory()
  .createValueExpression(facesContext.getELContext(), "#{foo.bar}",
Object.class);
childComponent.setValueExpression(ve);

-Andrew

On Fri, Sep 26, 2008 at 1:51 PM, Shane Petroff <[EMAIL PROTECTED]> wrote:
> Paul Spencer wrote:
>>
>> I need to dynamically add a child component inside a bean. I have access
>> to the component via a binding and have successfully added the child
>> component.  What I have not been able to do is set the value of the child
>> component to an EL Expresion so it is resolve by JSF 1.2.
>>
>> The equivalent tag for the child component is:
>>  <tr:inputText value="#{foo.bar}"/>
>>
>> So far I have:
>>   CoreInputText childComponent;
>>   childComponent = (CoreInputText)
>> application.createComponent(CoreInputText.COMPONENT_TYPE);
>>   // Set the value to an EL Expression
>>   childComponent.setValue("#{foo.bar}"); // Does not work
>>
>
> ValueBinding vb = application.createValueBinding(elExpression);
> vb.setValue(context, value);
>
> Will work, but iirc, this is deprecated, and there is an alternate for 1.2,
> namely ValueExpression
>
> Shane
>
>
>
> --
> Shane
>
>

Reply via email to