我有一个模板,我可以这样做:
<#if result.numFound > 10>
(some data)
</#if>
这给了我解析错误:
For "#if" condition: Expected a boolean, but this evaluated to a number
result.numFound
是Integer
。
我读过documentation,也许我错过了什么......
答案 0 :(得分:8)
你错过了文档中的最后几行:)。
How to test if x is greater than 1? <#if x > 1> will be wrong, as FreeMarker will
interpret the first > as the end of the tag. Thus, either write <#if (x > 1)> or <#if x > 1>.