我Apache Velocity
用于创建电子邮件模板。我有一封邮件,其中包含一个包含元素列表的表格,为了创建它,我使用了#foreach
.
在此表中,我将添加一个包含条件字符串的列,如果元素为空,则字符串string1
is if is not empty are string2
。
这是我的代码:
#foreach( $item in $list )
<td style="max-width: 140px; word-wrap: break-word;">
#if(${value} not null) 'String1' #else 'String2'#end</td>
#end
错误日志:
org.apache.velocity.runtime.parser.ParseException: Encountered "null" at line 25, column 131. Was expecting one of:
"[" ...
"{" ...
"(" ...
<STRING_LITERAL> ...
"true" ...
"false" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<IDENTIFIER> ...
"{" ...
"[" ...
at org.apache.velocity.runtime.parser.Parser.generateParseException(Parser.java:3679)
我在堆栈中找不到任何帮助...有人可以帮助我吗?