freemarker自己定义标签(一)

freemarker自己定义标签


1、自己定义标签说明

     宏变量存储模板片段能够被用作自己定义指令macro


2、演示样例说明

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>freemarker自己定义标签</title>

  </head>
  
  <body>
     <#--freemarker自己定义标签-->
	 <#macro write>
	     repeat("张三丰",3)
	 </#macro>
	 
	 <@write/>
  </body>
</html>

3、演示样例结果

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>freemarker自己定义标签</title>

  </head>
  
  <body>
     	 
	     repeat("张三丰",3)
  </body>
</html>


原文地址:https://www.cnblogs.com/gcczhongduan/p/4280876.html