Apache Velocity $ 与 $!{}
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1978061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apache Velocity $ vs $!{}
提问by Luke
For apache velocity, is there a difference between accessing variables with $ vs. $!{}. If so, what is it?
对于 apache 速度,使用 $ 和 $!{} 访问变量之间是否存在差异。如果是,那是什么?
回答by brianegge
There's two differences, the second is formaland quiet.
Formal reference notations include the braces around the variable. The quiet notation includes the !and means to output nothing if the reference does not exist. When combining them, you create a formal and quiet notation.
正式的引用符号包括变量周围的大括号。!如果引用不存在,安静符号包括和 表示不输出任何内容。组合它们时,您可以创建正式而安静的符号。

