freemarker自定义标签

1、自定义标签

通过自定义标签,写一个重复指定字符串

2、实现源码

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

  </head>

  <body>
     <#--freemarker自定义标签-->
	 <#macro repeat nums=40 name="你好">
	      <#list 1..nums as n>
	           <h1>张三,${name}${n}</h1>
	      </#list>
	 </#macro>

     <@repeat/>
  </body>
</html>

3、实现结果

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

  </head>

  <body>

	           <h1>张三,你好1</h1>
	           <h1>张三,你好2</h1>
	           <h1>张三,你好3</h1>
	           <h1>张三,你好4</h1>
	           <h1>张三,你好5</h1>
	           <h1>张三,你好6</h1>
	           <h1>张三,你好7</h1>
	           <h1>张三,你好8</h1>
	           <h1>张三,你好9</h1>
	           <h1>张三,你好10</h1>
	           <h1>张三,你好11</h1>
	           <h1>张三,你好12</h1>
	           <h1>张三,你好13</h1>
	           <h1>张三,你好14</h1>
	           <h1>张三,你好15</h1>
	           <h1>张三,你好16</h1>
	           <h1>张三,你好17</h1>
	           <h1>张三,你好18</h1>
	           <h1>张三,你好19</h1>
	           <h1>张三,你好20</h1>
	           <h1>张三,你好21</h1>
	           <h1>张三,你好22</h1>
	           <h1>张三,你好23</h1>
	           <h1>张三,你好24</h1>
	           <h1>张三,你好25</h1>
	           <h1>张三,你好26</h1>
	           <h1>张三,你好27</h1>
	           <h1>张三,你好28</h1>
	           <h1>张三,你好29</h1>
	           <h1>张三,你好30</h1>
	           <h1>张三,你好31</h1>
	           <h1>张三,你好32</h1>
	           <h1>张三,你好33</h1>
	           <h1>张三,你好34</h1>
	           <h1>张三,你好35</h1>
	           <h1>张三,你好36</h1>
	           <h1>张三,你好37</h1>
	           <h1>张三,你好38</h1>
	           <h1>张三,你好39</h1>
	           <h1>张三,你好40</h1>
  </body>
</html>

freemarker自定义标签(二)的更多相关文章

  1. freemarker自定义标签(二十一)

    一,讲解一 1.自定义标签说明 宏变量存储模板片段可以被用作自定义指令macro 2.示例说明 <html> <head> <meta http-equiv=" ...

  2. freemarker自定义标签报错(二)

    freemarker自定义标签 1.错误描述 freemarker.core.ParseException: Unexpected end of file reached. at freemarker ...

  3. OneBlog开源博客-详细介绍如何实现freemarker自定义标签

    前言 OneBlog中使用到了springboot + freemarker的技术,同时项目里多个controller中都需要查询一个公有的数据集合,一般做法是直接在每个controller的方法中通 ...

  4. freemarker自定义标签报错(六)

    freemarker自定义标签 1.错误描述 freemarker.core.ParseException: Encountered "\"\u4f60\u597d\uff01\& ...

  5. freemarker自定义标签报错(五)

    freemarker自定义标签 1.错误描述 六月 05, 2014 11:40:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严 ...

  6. freemarker自定义标签报错(四)

    freemarker自定义标签 1.错误描述 六月 05, 2014 11:31:35 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严 ...

  7. freemarker自定义标签(一)

    freemarker自定义标签 1.自定义标签说明 宏变量存储模板片段可以被用作自定义指令macro 2.示例说明 <html> <head> <meta http-eq ...

  8. freemarker自定义标签报错(三)

    freemarker自定义标签 1.错误描述 freemarker.core.ParseException: Encountered " " at line 14, column ...

  9. freemarker自定义标签报错(一)

    freemarker自定义标签 1.错误描述 freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgr ...

随机推荐

  1. Mysql 时间格式默认空串 '0000-00-00 00:00:00' select抛出异常的解决方法

    Mysql 时间格式默认插入值为空时,会以'0000-00-00 00:00:00'填充,这时如果select时会抛出SQLExecption如下: java.sql.SQLException: Va ...

  2. vue2使用高德地图vue-amap定位以及AMapUI标注

    前言 最近在vue里使用了高德地图vue-amap以及AMapUI,我在这里就说下如何在vue2里引入vue-amap和AmapUI以及使用定位 (在这里默认你已经安装了vue-cli) 安装 npm ...

  3. ZooKeeper安装(Windows)

    概述 ZooKeeper是Hadoop的正式子项目,它是一个针对大型分布式系统的可靠协调系统,提供的功能包括:配置维护.名字服务.分布式同步.组服务等.ZooKeeper的目标就是封装好复杂易出错的关 ...

  4. MySQL完全备份、增量备份与恢复[转]

    原文链接:http://www.360doc.com/content/11/1209/09/834950_170836197.shtml 场景:每周日执行一次完全备份,每天下午1点执行增量备份 [ 适 ...

  5. 洛谷 [P1119] 灾后重建

    我们发现每次询问都是对于任意两点的,所以这是一道多源最短路径的题,多源最短路径,我们首先想到floyd,因为询问的时间是不降的,所以对于每次询问,我们将还没有进行松弛操作的的点k操作. #includ ...

  6. BZOJ 2707: [SDOI2012]走迷宫 [高斯消元 scc缩点]

    2707: [SDOI2012]走迷宫 题意:求s走到t期望步数,\(n \le 10^4\),保证\(|SCC| \le 100\) 求scc缩点,每个scc高斯消元,scc之间直接DP 注意每次清 ...

  7. ZOJ 2314 Reactor Cooling [无源汇上下界网络流]

    贴个板子 #include <iostream> #include <cstdio> #include <cstring> #include <algorit ...

  8. H5弹性盒布局的使用(父容器属性)

    为父容器添加display:flex/inline-flex 父容器可以使用的属性有: 1.flex-direction:决定主轴的方向 有四个属性值: row(默认值):主轴为水平方向,起点在左端. ...

  9. Windows Azure Virtual Network (11) 虚拟网络之间点对点连接VNet Peering

    <Windows Azure Platform 系列文章目录> 在有些时候,我们需要通过VNet Peering,把两个虚拟网络通过内网互通互联.比如: 1.在订阅A里的Virtual N ...

  10. Windows Azure Platform Introduction (14) 申请海外的Windows Azure账户

    <Windows Azure Platform 系列文章目录> 本文的最后更新时间为:2017-12-27 本文介绍国内用户,注册和使用海外Azure账户. 前提: 1.需要一个有效的Wi ...