我是 freemarker 模板的新手。我需要根据 boolean 条件显示一个字符串。解析 ftl 文件时出现错误
<#if debitNote.gst?string("Yes", "No")>
错误
if debitNote.gst?string("Yes", "No") [on line 150, column 95 in creditDebitCustomer.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.NonBooleanException:
最佳答案
您可以使用三元表达式 then
表达式:
${debitNote.gst?then("Yes", "No")}
The
string
boolean builtin function has been deprecated since FreeMarker 2.3.20 and has been replaced withthen
.
关于java - FTL 中的 boolean 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34759988/