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>
    



  • 相关阅读:
    倒水问题(BFS)
    小程序整理
    微信小程序--录音
    mpvue
    hbuilder 打包 vueAPP
    react rem
    react 关闭eslint 配置
    react axios 配置
    react 路由之react-router-dom
    react mobx 装饰器语法配置
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5102497.html
Copyright © 2011-2022 走看看