I am trying to use com.google.common.collect.Multimap <String, Foo> from Freemarker.
In Multimap, for each key on the map, you return a Collection.
I tried the following, but this did not work:
Java:
context.put("itemsByCategory", itemsByCategory);
FreeMarker:
<#list exclusiveItems?keys as cat> ${cat}<br/> <#assign items = exclusiveItems[cat]> <#list items as item> ${item.id} </#list> </#list>
I got the following exception. It seems that he views the Elements as a scalar, although this is actually a collection.
?size is unsupported for: freemarker.ext.beans.SimpleMethodModel The problematic instruction: ---------- ==> list items as item [on line 61, column 49 in email/foo/foo-html.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateModelException: ?size is unsupportefor:freemarker.ext.beans.SimpleMethodModel
source share