Java 如何在Freemarker中迭代某些类的HashMap和类列表
我如何在freemarker模板中迭代此过程:Java 如何在Freemarker中迭代某些类的HashMap和类列表,java,freemarker,Java,Freemarker,我如何在freemarker模板中迭代此过程: Map<Foo, List<Bar>> map = new HashMap<>(); Map Map=newhashmap(); 我试过了,但是运气不好 <#list map?keys as key> <p>${key.blah()}</p> <#list map[key] as values values> <p>${value.bar
Map<Foo, List<Bar>> map = new HashMap<>();
Map Map=newhashmap();
我试过了,但是运气不好
<#list map?keys as key>
<p>${key.blah()}</p>
<#list map[key] as values values>
<p>${value.bar()}</p>
</#list>
</#list>
${key.blah()}
${value.bar()}
您需要循环映射/哈希:
${value.bar()}
包含散列中所有变量(键值对中的值)的序列
<#list map?values as currentList>
<#list currentList as value>
<p>${value.bar()}</p>
</#list>
</#list>