title: Primefaces Nested DataTable with InputText Not Updating Bean
body: <p>I've a dataTable within a dataTable.  The initial dataTable has a list of components that appear on the page.  One of these components will be a list of strings which can have elements added or deleted. When I change a string in this list, I expect the value to show up in the bean and it is not.</p>
  <p>Below I have an example of my problem. The page renders a text input field for the first component then three text input fields to represent the second component which is a list of three input fields.</p>
  <p>I have  valueChange listener on all the input fields.  The listener, is in the InnerBean class, prints out the source and the value that changed.<br />
  For the standalone input field, the listener correctly prints out the changed value and shows that the bean has been updated with this value.  For any of the input fields from the list, the listener prints out the previous value of the input field and the bean has not been updated. On the ajax update of the inner datatable, the changed value is replace with the original value.</p>
  <p>Since the valueChange listener is called, it appears that Primefaces knows that the value has changed.  The code just doesn't seem to record the changed value.</p>
  <p>Any help is appreciated.</p>
  <p>I'm using <code>Primefaces 8.0</code> and <code>JSF 2.2.20</code>.</p>
  <p>Here is the <code>xhtml</code>:</p>
  <pre><code>                &lt;p:panel id=&quot;testPanel&quot; header=&quot;#{myController.outerBean.name}&quot; toggleable=&quot;true&quot; collapsed=&quot;false&quot; &gt;
                      
                      &lt;p:dataTable id=&quot;testTable&quot; value=&quot;#{myController.outerBean.innerBeanList}&quot; var=&quot;bean&quot;&gt;
                          
                          &lt;p:column &gt;
                          
                              &lt;!-- TEXT COMPONENT--&gt;
                              &lt;h:panelGroup rendered=&quot;#{bean.type eq 'text'}&quot; &gt;
                                  &lt;p:inputText id=&quot;textfield&quot; value=&quot;#{bean.value}&quot; style=&quot;width:100%;&quot; &gt;
                                      &lt;p:ajax event=&quot;valueChange&quot; listener=&quot;#{bean.textListListener}&quot;  update=&quot;testTable&quot; /&gt;
                                  &lt;/p:inputText&gt;
                              &lt;/h:panelGroup&gt;
                              
                              &lt;!-- LIST COMPONENT --&gt;
                              &lt;h:panelGroup rendered=&quot;#{bean.type eq 'textlist'}&quot; &gt;
                                  &lt;p:dataTable id=&quot;testListTable&quot; styleClass=&quot;datatableWithoutBorder&quot; style=&quot;width:320px&quot; 
                                          var=&quot;textAddition&quot; value=&quot;#{bean.list}&quot; rowIndexVar=&quot;rowIndex&quot; &gt;    
                                      &lt;p:column &gt;
                                          &lt;p:inputText id=&quot;textAdd&quot; value=&quot;#{textAddition}&quot; style=&quot;width: 100%;&quot;&gt;
                                              &lt;p:ajax event=&quot;valueChange&quot; listener=&quot;#{bean.textListListener}&quot; update=&quot;testListTable&quot;/&gt;                                            
                                          &lt;/p:inputText&gt;
                                      &lt;/p:column&gt;
                                  &lt;/p:dataTable&gt;
                              &lt;/h:panelGroup&gt;
                              
                          &lt;/p:column&gt;
                      &lt;/p:dataTable&gt;
  
                      &lt;h:panelGrid columns=&quot;1&quot;  style=&quot;width:100%;&quot;&gt;
                          &lt;h:panelGroup style=&quot;float:right&quot;&gt;
                              &lt;p:commandButton id=&quot;submitBtn&quot; value=&quot;Submit&quot;
                                  action=&quot;#{dummyController.submit}&quot;
                                  update=&quot;messages @this&quot; 
                                  icon=&quot;fa fa-save&quot;/&gt;
                          &lt;/h:panelGroup&gt;
                      &lt;/h:panelGrid&gt;
                  &lt;/p:panel&gt;
  </code></pre>
  <p>My controller code:</p>
  <pre><code>public class MyController {
  
  private OuterBean outerBean;
  
  public MyController() {
      System.out.println(&quot;MyController instantiated&quot;);
      setOuterBean(new OuterBean());
  }
  
  public void submit() {
      for (InnerBean ab: outerBean.getInnerBeanList()) {
          System.out.println(ab.getLabel() + &quot;: &quot; + ab.getValue() + &quot;:&quot; + ab.getList() );
      }
  }
  
  public void clear() {
      // TODO
  }
  
  // Getter/Setter methods
  public OuterBean getOuterBean() {
      return outerBean;
  }
  public void setOuterBean(OuterBean outerBean) {
      this.outerBean = outerBean;
  }
  </code></pre>
  <p>}</p>
  <p>My OuterBean with the list of components:</p>
  <pre><code>public class OuterBean implements Serializable {
  
  private String name;
  private String value;
  private List&lt;InnerBean&gt; innerBeanList;
  
  public OuterBean() {
  
      name = &quot;Entry Panel #1&quot;;
      value = &quot;&quot;;
  
      innerBeanList = new ArrayList&lt;InnerBean&gt;();
      InnerBean ab1 = new InnerBean(); 
      ab1.setLabel(&quot;First Component&quot;);
      ab1.setType(&quot;text&quot;);
      ab1.setValue(&quot;Input text&quot;);
      innerBeanList.add(ab1);
      
      InnerBean ab2 = new InnerBean();
      ab2.setLabel(&quot;Second Component&quot;);
      ab2.setType(&quot;textlist&quot;);
      ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
      list.add(&quot;Item 1&quot;);
      list.add(&quot;Item 2&quot;);
      list.add(&quot;Item 3&quot;);
      ab2.setList(list);
      innerBeanList.add(ab2);
  }
  
  //
  // Getter/Setters
  //
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public String getValue() {
      return value;
  }
  
  public void setValue(String value) {
      this.value = value;
  }
  
  public List&lt;InnerBean&gt; getInnerBeanList() {
      return innerBeanList;
  }
  
  public void setInnerBeanList(List&lt;InnerBean&gt; innerBeanList) {
      this.innerBeanList = innerBeanList;
  }
  </code></pre>
  <p>}</p>
  <p>My InnerBean which represents a component to be render.  One of which can be a list of strings:</p>
  <pre><code>public class InnerBean implements  Serializable {
  
  // Type of component
  public static final String TEXT = &quot;text&quot;;
  public static final String TEXTLIST = &quot;textlist&quot;;
  
  private String label;
  private String type;  // If TEXT, use value; if TEXTLIST, use list.
  private String value;
  private List&lt;String&gt; list = new ArrayList&lt;String&gt;();
  
  public InnerBean() {
  }
  
  public void textListListener(AjaxBehaviorEvent event) {
      System.out.println(&quot;Listener called&quot;);
      System.out.println(&quot;       Source: &quot; + event.getSource().toString());
      System.out.println(&quot;        Value: &quot; + ((UIInput)event.getSource()).getValue());
      System.out.println(&quot;         List: &quot; + list.toString());
      System.out.println(&quot;        Event: &quot; + event.toString());
  
  }
  
  //
  // Setters and getters
  //
  
  public String getLabel() {
      return label;
  }
  
  public void setLabel(String label) {
      this.label = label;
  }
  
  public String getType() {
      return type;
  }
  
  public void setType(String type) {
      this.type = type;
  }
  
  public String getValue() {
      return value;
  }
  
  public void setValue(String value) {
      this.value = value;
  }
  
  public List&lt;String&gt; getList() {
      return list;
  }
  
  public void setList(List&lt;String&gt; list) {
      this.list = list;
  }
  </code></pre>
  <p>}</p>