速度:是一种检查变量是否已定义的方法 [英] Velocity: Is a any way to check if variable is defined

查看:27
本文介绍了速度:是一种检查变量是否已定义的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个模板nested 包含到其他cont1cont2cont3 中.嵌套模板应该只为 cont1 隐藏一个特定的控件.在包含到 cont1 之前,我想为某个标志变量 $hideMyControl 赋值.

I want to include one template nested into others cont1, cont2, cont3. And nested template should be hide one specific control for cont1 only. Before inclusion into cont1 I would like to assign value to some flag variable $hideMyControl.

在嵌套模板中,我想检查是否为 $hideMyControl 赋值.

And inside nested template I would like to check if $hideMyControl is assigned value.

如何进行此类检查?

推荐答案

您可以使用

  #if($!{$articleLeader})
      // Perform your operation or the template part you want to show.
  #end

有关详细信息,请参阅 Apache 的正式参考"部分速度参考手册.

For more info, see the 'formal reference' section of the Apache Velocity Reference Manual.

这篇关于速度:是一种检查变量是否已定义的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆