freemarker基本数据类型(十一)

freemarker基本数据类型

 

假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击http://106.12.206.16:8080/qingruihappy/index.html

1、基本数据类型

(1)字符串

(2)数字

(3)布尔值

(4)日期

 

2、展示示例

 1 <html>
 2   <head>
 3     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
 4     <title>freemarker基本数据类型</title>
 5 
 6   </head>
 7   
 8   <body>
 9      <#--freemarker基本数据类型:1、字符串,2、数字,3、布尔值,4、日期-->
10      <#--定义字符串-->
11      <#assign str = "张三丰"/>
12      ${str}
13      
14      <#--定义数字-->
15      <#assign number = 123456/>
16      ${number}
17      
18      <#--定义布尔值-->
19      <#assign flag = true/>
20      ${flag?string}
21      
22      <#--日期类型-->
23      ${nowsday?string("yyyy-MM-dd")}
24   </body>
25 </html>

 

 3、测试方法

 1 /**
 2      * freemarker基本数据类型
 3      * @Title:testDataType
 4      * @Description:
 5      * @param:
 6      * @return: void
 7      * @throws
 8      */
 9     @Test
10     public void testDataType()
11     {
12         root.put("nowsday", new Date());
13         studentPrint("type.ftl");
14     }


4、示例结果

 1 <html>
 2   <head>
 3     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
 4     <title>freemarker基本数据类型</title>
 5 
 6   </head>
 7   
 8   <body>
 9           张三丰
10      
11      123,456
12      
13      true
14      
15      2014-05-31
16   </body>
17 </html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值