freemarker学习

来源:互联网 发布:java 进程 编辑:程序博客网 时间:2024/06/10 11:17
概念: freemarker就是一种模板引擎。核心就是  ftl(freemarker的模板 freemarker template language)
       模板+数据=数据输出

关键指令:<#if></#if>、<#list  lists  as  temp><#list>、${attribute}、<#macro><#macro>宏定义,主要自定义一些指令、<@macro_name></@marcro_name>这种主要是使用了自定义的宏就是用 @这么一个符号
freemarker:的ui其实就是自己封装的一些组件

<#nested></#nested>
     nested标签表示一个站位标签,表示外面的其他内容可方在这个地方,并且相应的如果有需要解析的标签也会进行相应的解析。
用法: <#nested  a,b>这种形式的表示a、b的值可以往外的带,就是我们可以拿到值。

<#macro></#macro>宏定义标签:
     我们可以自定义一个控件标签,用法: 声明<#macro macroName ></#macro>  ,使用<@macroName></@macroName>或者<@macroName/>

<#list></#list>  遍历操作
     用法:  <#list mylist  as  t> ${t}</#list>  ;mylist是由程序准备的  t是循环变,${t}这个是取值

<#include "need include url" ></#include>包含某一文件,把其内容包含进来

<#local name = name1  value=value1 ></#local>:这个是定义一个变量,它只在宏和方法的内部定义才有用,







0 0
原创粉丝点击