freemarker基礎資料型別 (Elementary Data Type)
1、基礎資料型別 (Elementary Data Type)
(1)字串
(2)數字
(3)布爾值
(4)日期
2、展示樣本
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>freemarker基礎資料型別 (Elementary Data Type)</title> </head> <body> <#--freemarker基礎資料型別 (Elementary Data Type):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基礎資料型別 (Elementary Data Type) * @Title:testDataType * @Description: * @param: * @return: void * @throws */@Testpublic 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基礎資料型別 (Elementary Data Type)</title> </head> <body> 張三丰 123,456 true 2014-05-31 </body></html>