freemarker处理哈希表的内建函数

时间:2014-06-20 12:18:04   收藏:0   阅读:173

freemarker处理哈希表的内建函数


1、简易说明

(1)map取值

(2)key取值


2、实现示例

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>freemarker处理哈希表的内建函数</title>

  </head>
  
  <body>
     <#--freemarker HashMap取值-->
	 <#assign maps={"1":"张三丰","2":"李思思","3":"张三强","4":"王五"}>
	 ${maps["3"]}
	 
	 <#assign stu={"name":"zhangsan","age":"21","sex":"man"}>
	 <#assign keys = stu?keys>
     <#list keys as key>
         ${key} = ${stu[key]};
     </#list>
  </body>
</html>

3、示例结果

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>freemarker</title>

  </head>
  
  <body>
     	 张三强
	 
         name = zhangsan;
         age = 21;
         sex = man;
  </body>
</html>


freemarker处理哈希表的内建函数,布布扣,bubuko.com

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