title: Multidimensional list in Thymeleaf (Java) - List<List<Object>>
body: <p>Have anyone of you any suggestion, how to iterate through a multidimensional list in Thymeleaf?</p>
  
  <p>My multidimensional list looks as follow:</p>
  
  <pre><code>@Override
  public List&lt;List&lt;PreferredZone&gt;&gt; findZonesByPosition(List&lt;Position&gt; positionList) {
  
          List &lt;PreferredZone&gt; prefZone = new ArrayList&lt;&gt;();
          List&lt;List&lt;PreferredZone&gt;&gt; listPrefZone = new ArrayList&lt;&gt;();
          long positionId = 0;
  
          for (int i = 0; i &lt; positionList.size(); i++) {
  
              positionId = positionList.get(i).getPositionId();
              prefZone = prefZoneDAO.findFilteredZone(positionId);
  
              listPrefZone.add(prefZone);
          }
  
      return listPrefZone;
  }
  </code></pre>
  
  <p>In my controller as attribute:</p>
  
  <pre><code>List&lt;List&lt;PreferredZone&gt;&gt; prefZoneList = prefZoneService.findZonesByPosition(positionList);
      model.addAllAttributes(prefZoneList);
  </code></pre>
  
  <p>Finally I try to iterate this two dimensional list in a HTML table:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table th:each="prefList :#{prefZoneList}" class="table table-striped display hover"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;ISO&lt;/th&gt;
        &lt;th&gt;Name&lt;/th&gt;
        &lt;th&gt;Ausschluss&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;!-- Loop für die Daten --&gt;
   
    &lt;tr th:each="row, iterState :${prefList}" class="clickable-row"&gt;
      &lt;td th:text="${row[__${iterState.index}__]}.zoneIso"&gt;&lt;/td&gt;
      &lt;td th:text="${row[__${iterState.index}__]}.zoneName"&gt;&lt;/td&gt;
      &lt;td style="text-align:center;"&gt;
        &lt;input type="checkbox" th:value="${${row[__${iterState.index}__]}.zoneId}" id="zone" class="checkbox-round" /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>It doesn't work however. I don't have any other idea how to solve this.
  I have to have a multidimensional list, because I have got a table with multiple records and each record contains a button to open a modal window. Each of this windows contains either a HTML table where I have to display the records.</p>
  
  <p>Have you got any suggestion for me?</p>