title: How to access each arraylist within arraylist with thymeleaf?
body: <p>There are Three classes</p>
  
  <pre><code>public Class Port{
  
  private String portname;
  // with getters and setters
  }
  
  public Class Application{
  private String appName;
  private List&lt;Port&gt; ports=  new ArrayList&lt;Port&gt;();
  //  with getters and setters
  }
  
  public Class Service{
  private String serviceName;
  private List&lt;Application&gt; apps=  new ArrayList&lt;Application&gt;();
  //  with getters and setters
  }
  </code></pre>
  
  <p>Below snippet is part of the Thymeleaf HTML code to iterate through the fields. </p>
  
  <pre><code>&lt;form action="#" th:action="@{/processWrapper}" th:object="${service}" method="post"&gt;
  &lt;table&gt;
  &lt;div th:each="app, stat : *{apps}"&gt;
  &lt;tr&gt;                   
  &lt;td&gt;&lt;input type="text" th:field="*{apps[__${stat.index}__].appName}" th:name="|apps[${stat.index}]|" /&gt;&lt;/td&gt;
  &lt;div th:each="port, stat1 : *{app.ports}"&gt;
  &lt;td&gt;&lt;input type="text" th:field="*{app.ports[__${stat1.index}__].portname}" th:name="|app.ports[${stat1.index}]|" /&gt;&lt;/td&gt;
      &lt;/div&gt;
      &lt;/div&gt;&lt;/table&gt;&lt;/form&gt;
  </code></pre>
  
  <p>Why is it not working?I get the error message:</p>
  
  <blockquote>
    <p>Property or field 'ports' cannot be found on object of type 'service' maybe not public?</p>
  </blockquote>