title: How to set the value of a composite component from outside the composite component
body: <p>So, I have a composite component. Inside it, I have a regular text input, using one of the composite component's attributes for a value.</p>
  
  <pre><code>&lt;h:inputTextarea id="#{cc.attrs.id}Text" value="#{cc.attrs.value}"&gt;
      &lt;f:ajax event="blur" listener="#{someBean.onBlur}" /&gt;
  &lt;/h:inputTextarea&gt;
  </code></pre>
  
  <p>As you can see, I have an event inside the text box. This event opens a popup and populates it with the text on the composite control. It also saves a reference to the composite control that invoked it. Let me show you:</p>
  
  <pre><code>public void onBlur(AjaxBehaviorEvent event) {
      this.fieldReference = (UIInput) event.getSource();
  
      this.formula = this.fieldReference.getValueExpression("value")
              .getValue(FacesContext.getCurrentInstance().getELContext())
              .toString();
  
      this.displayPopup = true;
  }
  </code></pre>
  
  <p>So far, so good. Now, the problem comes when I try to close the popup and then update the value on the composite component with the one entered on the popup. I try to do this:</p>
  
  <pre><code>public void accept(ActionEvent event) {
      this.fieldReference
              .getValueExpression("value")
              .setValue(FacesContext.getCurrentInstance().getELContext(), this.formula);
      this.displayPopup = false;
  }
  </code></pre>
  
  <p>When I try that, I get:</p>
  
  <p><code>javax.el.PropertyNotFoundException: //C:/myProject/Path/compositeComponentPage.xhtml at line 22 and column 183 value="#{cc.attrs.value}": Target Unreachable, identifier 'cc' resolved to null</code></p>
  
  <p>Seems to me that the EL context on that request is different, and thus cannot resolve the variables in the composite component's expressions... but if I try to also store a reference to the ELContext object from the composite component's request (on the <code>onBlur()</code> method), then when I try to use it in <code>accept()</code>, I get:</p>
  
  <p><code>javax.faces.event.AbortProcessingException: java.lang.IllegalStateException: Error the FacesContext is already released!</code></p>
  
  <p>Using MyFaces 2.0.2 (the version that comes with WebSphere 8.5, I believe they modify it), and RichFaces 4.2.3.</p>
  
  <p>Any ideas?</p>