I'm trying to use a com.google.common.collect.Multimap<String, Foo> from Freemarker.
In a Multimap, for each key in the map, you get back Collection.
I tried the following but it didn't 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 appears it's treating Items as a scalar, although it's 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