我想這條線從速度轉換爲Freemarker的:如何將此行從Velocity轉換爲FreeMarker?
#set ($valid_portlet_description = $validator.isNotNull($portlet_description)
&& $portlet_description.indexOf('javax.portlet.description') == -1)
我試圖將代碼更改爲:
<#assign valid_portlet_description = validator.isNotNull(portlet_description)
&& portlet_description?index_of("javax.portlet.description") == "-1" />
但我得到這個以下錯誤:
freemarker.template.TemplateException
: The only legal comparisons are between two numbers, two strings, or two dates. Left hand operand is afreemarker.template.SimpleNumber
Right hand operand is afreemarker.template.SimpleScalar
請注意,您應該更新FreeMarker。 2.3.23給出了更容易理解的錯誤信息。 – ddekany
謝謝@ddekany! :) –