freemark常用

来源:互联网 发布:sql查询用户名和密码 编辑:程序博客网 时间:2024/06/07 10:28

1. 判断非空
<#if edit??>
<#else>
</#if>


2.循环遍历
<#list list as obj>
</#list>


3.字符串长度
 ${title?length}


4.字符串截取
${edit.CREATETIME?substring(0,10)!''}


5.获取到的数字有逗号(字符串使用会报错)
${edit.ID?c!''}


6.include
<#include "head.ftl">


7.获取项目路径
<#assign base=request.contextPath />


8.date 转 string

${obj.startTime?string("yyyy-MM-dd HH:mm:ss")!''}


9遍历数字  如分页

<#list 1..page as i>    
 <li><a href="#">${i}</a></li>
</#list>

原创粉丝点击