Reputation: 20936
In free marker template i want to print HashMap in HashMap. Is this possible?
I try with
<#list capitalList?keys as key>
${key} = ${capitalList[key]}
</#list>
but this not printing HashMapin HashMap. How can i do this with free marker template. Exist foreach or for?
Upvotes: 1
Views: 274
Reputation: 4262
You can use nest list
directive. A simple example:
<ul>
<#list hm2d?keys as hm2d_key>
<#assign hm = hm2d[hm2d_key]>
<li>${hm2d_key}:
<ul>
<#list hm?keys as key>
<li>${key} = ${hm[key]}</li>
</#list>
</ul>
</li>
</#list>
</ul>
Upvotes: 1