title: How do I add ajax behavior to a dynamically created component in a backing bean?
body: <p>In respose to Infragile's request in another thread, I am asking this as a separate question rather than a followup.</p>
  
  <p>Here is the problem I am attempting to address:
  I'm migrating from JSF1.2 to JSF2.  Everything worked fine in JSF1.2.
  I have rewritten a critical item to be a composite component which is basically a panel created in my backing bean by adding components in code.</p>
  
  <p>In particular, I have h:inputText and h:selectOneMenu components that I create in code along with an "Apply"  h:commandButton.
  The "Apply" button has an action listener that checks for the values in the h:inputText and h:selectOneMenu components.  All this works fine, but when I fetch the values in the h:inputText or h:selectOneMenu components I get the original values, not the new values that were entered by the user. Like I said, this worked fine in JSF1.2 (i got the new values), but not in JSF2 for some reason.</p>
  
  <p>I have tried several things to get around this that haven't worked, so I figured I would add ajax behavior to the h:inputText and h:selectOneMenu items and when the values in these components change, I could call another backing bean listener for the ajax behavior to fetch the new values. </p>
  
  <p>I am trying to add ajax behavior to a component I create in code (not bound to a page component). I can create the component with no problem. However, the problem that I am having is how to add the ajax behavior to the component.</p>
  
  <p>Could someone post sample code to add an ajax behavior for a value change or blur event? Here is the code I use to create the component in code - how would I need to modify it to add the ajax behavior?
      hpg = new HtmlPanelGrid(); 
      children = hpg.getChildren(); 
      children.clear(); 
      .... 
      input = new HtmlInputText(); 
      .... 
       
      children.add(input); </p>
  
  <p>What code would I have to add to replace the "add ajax behavior here" line, and what would the arguement for the listener method be (arguement for the method to replace the ????? below)?</p>
  
  <p>public void myAjaxListener(?????) { ...... {</p>
  
  <p>I have been trying to get a handle on this for some time now. I feel that I am pretty close, but don't know the syntax I need.  I can provide more information on how I am fetching the component Ids and searching for the values in my action listener if that will help.</p>
  
  <p>Thanks</p>