Freemarker常用代码

2011-12-14

${1234?c}
${"abcd"?substring(1, 3)} <!--从第2个字符开始截取到第3个字符结束-->
${"abcd"?length}
${"0123"?number}
1
2
3
4
<#assign arr=("a, b, c, d"?split(","))>
<#list arr as item>
	${item}
</#list>
${.now?string("yyyy-MM-dd HH:mm:ss")}
#{.now?long}
${url?replace("www.zhso.net", "zhso.net")}
1
2
3
<#list 1..10 as i>
#{i}
</#list>
1
2
3
<#list items as item>
#{item_index}
</#list>
1
2
3
4
5
<#list items as item>
  <#if item\_has\_next>
    item has next
  </#if>
</#list>
1
2
3
4
5
6
7
<#--当判断条件为真时-->
<#if title == "振华社">
  ${title}
<#--当判断条件不为真时-->
<#else>
  ${url}
</#if>

s@zhso.netPay