Freemarker遍历Java的Map

时间:2015-05-19 16:43:09   收藏:0   阅读:303

废话不说,看代码:

Java

Map<String, String> selectMap = new TreeMap<String, String>();
selectMap.put("platId", "平台ID");
selectMap.put("crawlerId", "爬虫ID");
request.setAttribute("selectMap", selectMap);
HTML

<select>
	<option value="all">所有字段</option>
	<#list selectMap?keys as key>
		<option value="${key}">${selectMap[key]}</option>
	</#list>
</select>	

效果:

技术分享

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!