ser*_*gtk 31 variables velocity template-engine
我想包括一个模板nested到别人cont1,cont2,cont3.并且嵌套模板应该只隐藏cont1的一个特定控件.在包含之前cont1我想为某些标志变量赋值$hideMyControl.
在嵌套模板中,我想检查是否$hideMyControl赋值.
怎么进行这样的检查?
小智 32
#if($hideMyControl)
// your code
#end
Run Code Online (Sandbox Code Playgroud)
如果定义了$ hideMyControl,则代码将执行
sag*_*r27 17
你可以使用
#if($!{$articleLeader})
// Perform your operation or the template part you want to show.
#end
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅Apache Velocity Reference Manual的"正式参考"部分.
小智 7
#if($!{hideMyControl} != "")
## do something if $hideMyControl is defined
#end
Run Code Online (Sandbox Code Playgroud)
这适用于AWS API网关主体映射模板.有关详细信息,请参阅Velocity用户指南中的安静参考表示法.