title: Tapestry loop through nested map in tml file
body: <p>I have following map </p>
  
  <pre><code>Map&lt;String, Map&lt;String, Long&gt;&gt;
  </code></pre>
  
  <p>This map is accessible through following method in java file.</p>
  
  <pre><code>public List&lt;Entry&lt;String, List&lt;Entry&lt;String, Long&gt;&gt;&gt;&gt; getByEventTypeSorted() {
      List&lt;Entry&lt;String, List&lt;Entry&lt;String, Long&gt;&gt;&gt;&gt; ret = new ArrayList&lt;Entry&lt;String, List&lt;Entry&lt;String, Long&gt;&gt;&gt;&gt;();
      ret.addAll((Collection&lt;? extends Entry&lt;String, List&lt;Entry&lt;String, Long&gt;&gt;&gt;&gt;) byEventType.entrySet());
      return ret;
  }
  </code></pre>
  
  <p>Thus I am converting  <code>Map&lt;String, Map&lt;String, Long&gt;&gt;</code> into <code>List&lt;Entry&lt;String, List&lt;Entry&lt;String, Long&gt;&gt;&gt;&gt;</code> and returning it.</p>
  
  <p>Now, in my tml file I am trying to loop through it like this.</p>
  
  <pre><code>&lt;tr t:type="Loop" t:source="summarizer.byEventTypeSorted" t:value="entry"&gt;
      &lt;td style="border: 1px solid #EEEEEE; padding: 3px"&gt;${entry.key}&lt;/td&gt;
      &lt;td style="border: 1px solid #EEEEEE; padding: 3px" t:type="Loop" t:source="${entry.value}" t:value="entry2"&gt; 
          ${entry2.key}
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Corresponding java file has following properties.</p>
  
  <pre><code>@Property
  private Entry&lt;String,Long&gt; entry;
  @Property
  private Entry&lt;String,Long&gt; entry2;
  </code></pre>
  
  <p>When I run the above code. Following exception is generated.</p>
  
  <pre><code>Failure writing parameter 'value' of component ConceptSummaries:loop_1: Could not find a coercion from type java.lang.String to type java.util.Map$Entry.
  </code></pre>
  
  <p>If I change the type of property entry2 to String in java file like below.....</p>
  
  <pre><code>@Property
  private Entry&lt;String,Long&gt; entry;
  @Property
  private String entry2;
  </code></pre>
  
  <p>And loop in tml file like below.</p>
  
  <pre><code>&lt;tr t:type="Loop" t:source="summarizer.byEventTypeSorted" t:value="entry"&gt;
      &lt;td style="border: 1px solid #EEEEEE; padding: 3px"&gt;${entry.key}&lt;/td&gt;
      &lt;td style="border: 1px solid #EEEEEE; padding: 3px" t:type="Loop" t:source="${entry.value}" t:value="entry2"&gt; 
          ${entry2}
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Then I get the whole list rendered as a single string.</p>
  
  <p>This means that tapestry is converting the <code>List&lt;Entry&lt;String, Long&gt;&gt;</code> into a String.
  I do not want that to happen as I want to loop through the list and access individual entries. </p>
  
  <p>How to loop through these nested maps? And is there any way to retain the type of inner list and prevent tapestry from converting it into a string?</p>
  
  <p><strong>Update:</strong>
  I was able to solve this problem using Lance Java's suggestions. Following are the details.</p>
  
  <p>code in tml file.</p>
  
  <pre><code>&lt;tr t:type="Loop" t:source="summarizer.byEventTypeSorted.entrySet()" t:value="entry"&gt;
      &lt;td style="border: 1px solid #EEEEEE; padding: 3px"&gt;${entry.key}&lt;/td&gt;
      &lt;td style="border: 1px solid #EEEEEE; padding: 3px" t:type="Loop" t:source="KeySetForEntryValue" t:value="entry2"&gt; 
          ${entry2.key}
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I have a getter method for <code>"KeySetForEntryValue"</code> and <code>Map&lt;String, Map&lt;String, Long&gt;&gt;</code> in corresponding java class.</p>
  
  <pre><code>public Set&lt;Entry&lt;String, Long&gt;&gt; getKeySetForEntryValue(){
      return entry.getValue().entrySet();
  }
  
  public Map&lt;String, Map&lt;String, Long&gt;&gt; getByEventTypeSorted() {
      return byEventType;
  }
  </code></pre>
  
  <p>And following are the properties in the same java class.</p>
  
  <pre><code>@Property
  private Entry&lt;String, Map&lt;String, Long&gt;&gt; entry;
  @Property
  private Entry&lt;String, Long&gt; entry2;
  </code></pre>