Freemarker assign list length to local variable

前端 未结 1 1786
轻奢々
轻奢々 2021-02-02 11:15

The following freemarker code causes an exception

<#assign i= it.getList().size()>
<#list it.getList() as elem>
    <#if i==1>
    
  • ${
  • 相关标签:
    1条回答
    • 2021-02-02 12:05

      I figured out, that it did not understood the syntax for the size built-in. The right syntax for assigning the size of a list to a local variable is

      <#assign i = it.getList()?size>
      
      0 讨论(0)
    提交回复
    热议问题