1.基础用法
mv.addObject("intVar", 100);
mv.addObject("longVar", 100000L);
mv.addObject("stringVar", "我是字符串":
mv.addObject("doubleVar", 3.45d);
mv.addObject("booleanVar", true);
mv.addObject("dateVar", new Date());
mv.addObject("nullVar", null);
整数 : <font color= 'red'> ${intVar} </font> <br/>
长整数: <font color= 'red'> ${longVar} </font> <br/>
字符串: <font color= 'red'> $(stringVar} </font> <br/>
双精度: <font color= "red'> ${doubleVar} </font> <br/>
布尔值: <font color= "red'> ${booleanVar?string'yes', 'no') </font> <br/>
日期 : <font color= "red'> ${dateVar ?string('yyy-MM -dd HH:mm:ss)} </font> <br/>
null: <font color= "red"> ${nulIVar!'我是默认值'} </font> <br/>
missing:<font color= "red"> ${sssVar!'我是默认值'} </font> <br/>
整数: 100
长整数: 00000
字符串: 我是字符串
双精度: 3.45
布尔值: yes
日期: 2020-2-6 20:32-56
null: 我是默认值
missing:我是默认值
2.字符串常用内建函数
< #assign a = 'hello'/>
< #assign b = 'world'/>
<li>连接</li>
<font color= "red">${a + b}</font> <br/>
<li>截取</li>
<font color= "red"> ${a + b)?substring(58)}</font> <br/>
<li>长度</i>
<font color= "red"> ${(a + b)?length}</font> <br/>
<li>大写</i>
<font color= "red"> $(a + b)?upper_case}</font> <br/>
<li>小写</li>
<font color= "red"> ${(a + b)?lower_case} </font> <br/>
<li> index_of</li>
<font color= "red"> ${(a + b)?index.of('w')}</font> <br/>
<li> replace </li>
<font color= "red"> ${(a + b)?replace('0','xx')}</font> <br/>
连接: helloworld
截取: wor
长度: 10
大写: HELLOWORLD
小写: helloworld
index.of: 5
replace: hellxxwxxrld