title: Retrieve the values of a nested list from JSP and send it back to form
body: <p><strong>EDIT</strong> Now I know my problem is due to <a href="https://wiki.apache.org/struts/StrutsCatalogLazyList" rel="nofollow noreferrer">this</a>. The link also provided solutions but I can't seem to figure out how to do it in the 2nd list.</p>
  
  <p>I will first show you the code structure I am working on.   </p>
  
  <p>Here is Class MyForm:</p>
  
  <pre><code>public class MyForm extends ValidatorForm {
      private List&lt;ADTO&gt; aDTOList;
  
      // getters and setters for aDTOList below
  
      public ADTO getADTO(int index) {
          if (aDTOList == null) {
              aDTOList = new ArrayList&lt;ADTO&gt;();
          }
          if (aDTOList.size() - 1 &lt; index) {
              while (aDTOList.size() - 1 &lt; index) {
                  aDTOList.add(new ADTO());
              }
          }
          return aDTOList.get(index);
      }
  
      @Override
      protected ActionErrors execValidate(ActionMapping mapping, HttpServletRequest request) {
            // BODY NOT SHOWN FOR PRIVACY
      }
  
      @Override
      public void reset(ActionMapping mapping, HttpServletRequest request) { 
          super.reset(mapping, request);
          this.aDTOList = new ArrayList&lt;ADTO&gt;();
      }
  
  
  }
  </code></pre>
  
  <p>Here is Class ADTO:</p>
  
  <pre><code>public class ADTO {
      private List&lt;BDTO&gt; bDTOList;
      // getters and setters for bDTOList below
  
  }
  </code></pre>
  
  <p>Here is Class BDTO:</p>
  
  <pre><code>public class BDTO {
      private String sample1;
      private String sample2;
      // getters and setters for sample1 and sample2 below
  
  }
  </code></pre>
  
  <p>I have successfully displayed the contents of <code>aDTOList</code> in the JSP by doing this:</p>
  
  <pre><code>&lt;logic:iterate id="ADTO" name="MyForm" property="aDTOList" indexId="idxRes"&gt;
      &lt;logic:iterate id="BDTO" name="ADTO" property="bDTOList" indexId="idxLine"&gt;
          &lt;html:hidden name="BDTO" property="sample1" indexed="true"/&gt;
          &lt;html:hidden name="BDTO" property="sample2" indexed="true"/&gt;
      &lt;/logic:iterate&gt;
  &lt;/logic:iterate&gt;
  </code></pre>
  
  <p>Now my problem is whenever I submit the form <code>bDTOList</code> that is inside <code>aDTOList</code> will become all null.<code>aDTOList</code> has the same size as the original list I have displayed but the only difference is that all elements of <code>bDTOList</code> in a <code>aDTO</code> is null. The structure of the <code>aDTOList</code> is like this if the size of <code>aDTOList</code> is 2 and each <code>ADTO</code> contains <code>bDTOList</code> which also has the size of 2.</p>
  
  <pre><code>[[null, null],[null, null]]
  </code></pre>
  
  <p>Thus I think my problem is I do not have <code>getBDTO</code> in my form, but I don't know how to implement it. Can anyone help me on how to implement it? Or is there any other means of populating <code>bDTOList</code> with the original data?</p>
  
  <p><strong>NOTE: I CAN'T CHANGE THE STRUCTURE OF THE CODES AND THE CODES ARE JUST SAMPLE CODES</strong></p>