读书人

freemarker中兑现自定义标签(包含处理

发布时间: 2012-10-31 14:37:31 作者: rapoo

freemarker中实现自定义标签(包含处理参数以及循环变量)(2.3.11版本以后的方式)

复制内容到剪贴板

  1. <#assign?x?=?1>????
  2. 一个参数: ??<@repeat?count=4>??
  3. ??Test?${x} ????<#assign?xx?=?x?+?1>??
  4. </@repeat>????
  5. 二个参数: ??<@repeat?count=3?hr=true>??
  6. ??Test ??</@repeat>??
  7. ??循环变量: ??
  8. <@repeat?count=3;?cnt>????${cnt}.?Test ??
  9. </@repeat>????


输出结果:

一个参数:
? Test 1
? Test 2
? Test 3
? Test 4

二个参数:
? Test
<hr>? Test
<hr>? Test

循环变量:
? 1. Test
? 2. Test
? 3. Test

读书人网 >编程

热点推荐