Apache Velocity 模板语言 - 忽略无效引用
假设我想在VTL中解析这样的地图。
map - { "person" = "xyz", age="99" }
使用 VTL,我将调用 $map.person
和 $map.age
在模板中插入适当的值。
现在假设地图不包含键“person”的任何有效值,
map - { age="99" }
如果我调用 $map.person
,VTL 将简单地返回 $map.person
。 我想完全忽略这样的引用被解析。我怎样才能实现这个目标?
Suppose I want to parse a map like this in VTL.
map - { "person" = "xyz", age="99" }
Using VTL, I would call $map.person
and $map.age
to insert the appropriate values in the template.
Now suppose the map does not hold any valid value for the key "person"
map - { age="99" }
If I call $map.person
, VTL simply will return $map.person
. I want to ignore such a reference from being parsed at all. How can I achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无声记号。是的,手册上有。
$!map.person
silent notation. yep, it's in the manual.
$!map.person