ITeye博客

velocity中的null与“”

xulongfa · 2009-07-15 20:30 · velocity · Markdown

问题:vecolity中 #set($test=$map.getAtttibute("key"))
         如果map.getAtttibute("key")为null,那么$test是null还是""  ?

结论:velocity引擎会报错:RHS of #set statement is null. Context will not be modified .

 

所以说最好是加上引号 ("")|感叹号 (!),  即#set($test=" $! map.getAtttibute("key")" )

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。