zoukankan      html  css  js  c++  java
  • freemarker基本数据类型

    freemarker基本数据类型


    1、基本数据类型

    (1)字符串

    (2)数字

    (3)布尔值

    (4)日期


    2、展示示例

    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>freemarker基本数据类型</title>
    
      </head>
      
      <body>
         <#--freemarker基本数据类型:1、字符串,2、数字,3、布尔值,4、日期-->
         <#--定义字符串-->
         <#assign str = "张三丰"/>
         ${str}
         
         <#--定义数字-->
         <#assign number = 123456/>
         ${number}
         
         <#--定义布尔值-->
         <#assign flag = true/>
         ${flag?string}
         
         <#--日期类型-->
         ${nowsday?string("yyyy-MM-dd")}
      </body>
    </html>
    

    3、测试方法

    /**
    	 * freemarker基本数据类型
    	 * @Title:testDataType
    	 * @Description:
    	 * @param:
    	 * @return: void
    	 * @throws
    	 */
    	@Test
    	public void testDataType()
    	{
    		root.put("nowsday", new Date());
    		studentPrint("type.ftl");
    	}

    4、示例结果

    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>freemarker基本数据类型</title>
    
      </head>
      
      <body>
              张三丰
         
         123,456
         
         true
         
         2014-05-31
      </body>
    </html>
    


  • 相关阅读:
    Linux 线程池的简单实现
    m3u8(HLS) 抓包
    一个面试问题的思考
    简单实现无需密码 sudo
    转: NAT 穿透
    一个平均分配算法
    raft 算法扫盲
    20210615 JVM 优化
    20210614. 并发编程
    20210606 Java 并发编程之美
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315065.html
Copyright © 2011-2022 走看看