java - Traversing nested HashMap in FreeMarker -
i have following data structure need traverse in freemarker
final map<string,map<string,list<person>>> root = fillmap();
for simplification imagine sort of taxonomy have “continent”, “country”, “person”, person
class person{ string name; string id; }
if want more clarification:
you might perform following operations in java (focus on var names)
map<string,list<person>> countriesforcontinent = root.get(“africa”); list<person> personsforcountry = countriesforcontinent.get(“kenya”);
in freemarker, need able list each continent in map; each continent, each country; each country, each person.
my html number of tabs (one per continent) , on each tab, have country section, , in each section list person belonging country.
difficulties
i having difficulties goes inside list tags. know example root continent
not make sense; don't know how fix it.
<#list root continent > ${continent} <#list continent country > ${country} <#list country person > ${person.name} ${person.id} </#> </#> </#>
in freemarker templates, can't list map
-s, keys (or values). have this:
<#list root?keys continentname> ${continentname} <#list root[continentname] country > ... </#list> </#list>
Comments
Post a Comment