title: How can I use Freemarker to show the List<Map<String,Object>> data?
body: <p>I put two <code>Map</code> objects in an <code>ArrayList</code>, and I want to show the different data based on the index of the arraylist, the java code is as follows:</p>
  
  <pre><code>List&lt;Map&lt;String, Object&gt;&gt; value = new ArrayList&lt;Map&lt;String, Object&gt;&gt;();
  value.add(originalUnitProps);
  value.add(nowUnitProps);
  </code></pre>
  
  <p>And the following is my template file:</p>
  
  <pre class="lang-freemarker prettyprint-override"><code>&lt;#list value as ori&gt;
      &lt;#if ori_index == 0&gt;
  
          original info：&lt;br/&gt;
  
          &lt;#list ori?keys as key&gt;
              ${key}:${ori[key]}  &lt;br/&gt;
          &lt;/#list&gt;
      &lt;#else&gt;
          &lt;br/&gt;
          now info：&lt;br/&gt;
          &lt;#list ori?keys as key&gt;
              ${key}:${ori[key]}  &lt;br/&gt;
          &lt;/#list&gt;
      &lt;/#if&gt;
  &lt;/#list&gt;
  </code></pre>
  
  <p>But it causes an exception:</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: freemarker.template.DefaultObjectWrapper could not convert java.util.ArrayList to a TemplateHashModel.</p>
  </blockquote>