Merging maps in Freemarker

2.3k Views Asked by At


I'm unable to find any documentation on how to merge two hash maps. This is what I am trying to acheive

<select <@render_attrs commonattrs.merge({"class":"select"}) /> > ....

<#macro render_attrs attrs>
<#list attrs?keys as key>
<#if attrs[key]!="">
${key}="${attrs[key]}"
</#if>
</#list>

1

There are 1 best solutions below

0
On BEST ANSWER
commonattrs + {"class": "select"}

It's documented here: http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_hashop