FreeMarker:期望一个布尔值,但是这被评估为一个数字

ex3*_*x3v 7 java template-engine freemarker

我有一个模板,我在其中:

<#if result.numFound > 10> 
  (some data)
</#if>
Run Code Online (Sandbox Code Playgroud)

这给了我解析错误:

For "#if" condition: Expected a boolean, but this evaluated to a number
Run Code Online (Sandbox Code Playgroud)

result.numFoundInteger.我已经阅读了文档,也许我错过了一些东西......

Mii*_*chi 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 &gt; 1>.
Run Code Online (Sandbox Code Playgroud)