我有以下速度模板构造
#if($no_of_entries > 1)
<strong>Its True !!</strong>
#else
<strong>Its False !!</strong>
#end
即使 大于 1,比如 10 ,$no_of_entries
它也会打印Its False!
这意味着$no_of_entries > 1
不工作
为什么$no_of_entries > 1
条件返回 false ?
我尝试打印值$no_of_entries
并打印正确的值> 1
编辑 :
我也尝试使用下面的代码
#if( Integer.parseInt($no_of_entries) > 1)
<strong>Its True !!</strong>
#else
<strong>Its False !!</strong>
#end
但它不起作用并抛出异常 -
org.apache.velocity.exception.ParseErrorException: Encountered "Integer" at file.vm
Was expecting one of:
"[" ...
"{" ...
"(" ...
<WHITESPACE> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<IDENTIFIER> ...
"{" ...
<WHITESPACE> ...