devtest
devtest

Reputation: 89

Iterating Map of Map of Map in freemarker

I need to iterate over this map in freemarker language.

public static void main(String[] args) {
       Map<String, Map<String, Map<String,String>>> map = new HashMap<>();
}

on the basis of each string i need to get map then again on the basis of string again map is needed. thanks

Upvotes: 0

Views: 1266

Answers (1)

Ori Marko
Ori Marko

Reputation: 58792

It seems there is three level nested map, you can drill down using list and you can show both key and value

Listing hashes is very similar, but you need to provide two variable names after the as; one for the hash key, and another for the associated value.

<#list map?values as vals>
  <#list vals?values  as innervals>
    <#list innervals as name, innerValue>
      ${name} value = ${innerValue}
    </#list>
  </#list>
</#list>

Upvotes: 1

Related Questions