【发布时间】:2017-04-08 18:56:21
【问题描述】:
我正在尝试在 Velocity 中将变量设置为 null。我正在尝试:
#set ($acessSpeed = null)
我正在阅读速度空支持 wiki。它说我们可以通过这种方式将值设置为 null。 https://wiki.apache.org/velocity/VelocityNullSupport
但是当我尝试它时,我收到一条错误消息“在 ....遇到“null”。”
我遇到的问题是,我有一个带有多个 if 块的巨大模板,如果满足条件,就会执行这些块。所以在每个 if 块结束时,我需要将 accessSpeed 的值设置为 null。
#if (some condition)
access speed value set here.
.
.
.
#end
// I need to set the access speed value to null here.
#if (some other condition)
access speed value to be set to something again.
.
.
.
#end
我可以为每个 if 块使用不同的变量,但我想知道是否有更简单的方法。
任何建议都会有所帮助。
【问题讨论】:
-
那个页面是关于suggestions的,实际上并不支持那个语法
-
@cricket_007 不是重复的,至少不是这个。
标签: java velocity velocity-tools