freemarker遍历map时,无故遍历出一堆map方法名的解决方案

用到 freemarker 遍历map时,无故遍历出一堆map方法名

public void index(){
        Map vmap =newLinkedHashMap();
        vmap.put("A","IT IS A");
        vmap.put("B","IT IS B");
        setAttr("vmap",vmap);  
        render("/common/search.html");
    }

页面显示:


<#list vmap?keys as k>
 ${k}
</#list>

结果输出了一堆map的方法名:

解决方案:

<#list vmap.keySet() as k>
${k}
</#list>



你可能感兴趣的:(freemarker)