相关疑难解决方法(0)

Freemarker和hashmap.我如何获得键值

我有一个哈希映射如下

HashMap<String, String> map = new HashMap<String, String>();
map.put("one", "1");
map.put("two", "2");
map.put("three", "3");

Map root = new HashMap();
root.put("hello", map);
Run Code Online (Sandbox Code Playgroud)

我的Freemarker模板是:

<html><body>
    <#list hello?keys as key> 
        ${key} = ${hello[key]} 
    </#list> 
</body></html>
Run Code Online (Sandbox Code Playgroud)

目标是在我生成的HTML中显示键值对.请帮我做.谢谢!

html java freemarker

20
推荐指数
3
解决办法
5万
查看次数

标签 统计

freemarker ×1

html ×1

java ×1