zoukankan      html  css  js  c++  java
  • freemarker自己定义标签(二)

    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>
    



  • 相关阅读:
    python3 TypeError: a bytes-like object is required, not 'str'
    Centos 安装Python Scrapy PhantomJS
    Linux alias
    Vim vimrc配置
    Windows下 Python Selenium PhantomJS 抓取网页并截图
    Linux sort
    Linux RSync 搭建
    SSH隧道 访问内网机
    笔记《鸟哥的Linux私房菜》7 Linux档案与目录管理
    Tornado 错误 "Global name 'memoryview' is not defined"
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5102497.html
Copyright © 2011-2022 走看看