freemarker list size问题

取得list的长度:${fields?size}。

而使用判断其长度的时候,

<#if fields?size>0 >
</#if>



竟抛出错了,说不是boolean类型,

Java backtrace for programmers:
----------
freemarker.core.NonBooleanException: Error on line 132, column 22 in viewEntity_js.ftl
Expecting a boolean (true/false) expression here
Expression fields?size does not evaluate to true/false
it is an instance of freemarker.template.SimpleNumber
         at freemarker.core.Expression.isTrue(Expression.java:150)


<#if (fields?size>0) >
</#if>

你可能感兴趣的:(freemarker)