首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Freemarker语法拾掇

2012-12-17 
Freemarker语法整理1、包含文件,并制定编码式#include header.ftlencodingutf-8 /2、判断对象是否存

Freemarker语法整理

1、包含文件,并制定编码格式

<#include "header.ftl"  encoding="utf-8" />

2、判断对象是否存在,并遍历

<#if commonDtoList ??>
  <#list commonDtoList as commonDto>
   <a href="${commonDto.id}">${commonDto.name}</a>
   <#if commonDto_has_next>
    <span>&gt;&gt;</span>
   </#if>
    </#list>
 </#if>

3、将freemarker页面中的整数转变为字符串

${id?c}

4、为变量赋值

<#assign htmlDirDefault="filesDir">

5、为变量指定默认值

${htmlDir!"filesDir"}

 

热点排行