码上敲享录 > freemarker常见问题解答 > ftl的list循环某个数字freemarker.template.TemplateException: Expected collection or sequence

ftl的list循环某个数字freemarker.template.TemplateException: Expected collection or sequence

上一章章节目录下一章 2017-12-19已有3709人阅读 评论(0)

freemarker的ftl页面的list标签一般都是循环集合,才不会报错,如果要像java的for那样循环特定的数字,就会报一下错误。


例如:循环4次

<#list 4 as t>

  aa

</#list>


报错如下:

freemarker.template.TemplateException: Expected collection or sequence. field['${sub}'].head.colNumber default(4) evaluated instead to freemarker.template.SimpleNumber on line 11, column 112 in com/bxsurvey/sys/process/tabletemplate/tb_common_detail.ftl.


解决方法:

<#list 1..4 as t>

  aa

</#list>

本文地址:http://www.yayihouse.com/yayishuwu/chapter/1069

向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交