2010-08-28 97 views
1

词法正确的语句下面的代码行是我工作的一个模板线的通用版本。我已经看过了Velocity模板语言Documentation,但我不断收到错误,无论我如何格式化这个说法。这是我与VTL第一次真正的经验,所以我希望得到一组经验丰富的眼睛问题:什么是Velocity模板语言

#set($includeAttributes = 
    ${firstResponseItem.attribute1} != null || 
    ${firstResponseItem.attribute2 != null) 

回答

2

中有速度没有null,但你可以检查空值,好像它是布尔false

#set($includeAttributes = $firstResponseItem.attribute1 || $firstResponseItem.attribute2)