velocity判断是否为null和 “”
来源:互联网 发布:sort二维数组排序 编辑:程序博客网 时间:2024/06/15 11:41
方法 1: 对null和false有效
#if( ! $car.fuel )
方法 2: 对null和""有效
#if( "$!car.fuel" == "" )
如果判断字段为空:
#if( "$car.fuel" == "" )
组合 方法 1 and 2,判断字段只能是null
#if ((! $car.fuel) && ("$!car.fuel" == ""))
方法 4: 使用工具检测,详见:http://wiki.apache.org/velocity/NullTool
#if( $null.isNull($car.fuel) )
方法 5: 使用自身方法检测
#if( $car.fuelEmpty )
car类实现isFuelEmpty()方法即可
public boolean isFuelEmpty()
{
// return true if fuel is empty.
}
方法 6: 使用自定义指令. cf. IfNullDirective, IfNotNullDirective
#ifnull( $car.fuel )
#ifnotnull( $car.fuel )
必须在velocity.properties.中注册:
userdirective = org.apache.velocity.tools.generic.directive.Ifnull
userdirective = org.apache.velocity.tools.generic.directive.Ifnotnull
0 0
- velocity判断是否为null和 “”
- Velocity学习--如何判断一个对象是否为空(null)
- Velocity学习--如何判断一个对象是否为空(null)
- velocity null和""判断
- velocity判断空和null
- Velocity判断null和空
- 【Velocity】Velocity常用参考(判断为null方法...)
- JS判断是否为null
- 集合判断是否为null
- 对象判断是否为null
- 对象判断是否为null
- 判断string是否为null
- js 判断是否为null
- Swift 判断是否为<null>
- fremarker 判断是否为null
- velocity 各种判断为null或者“null”或者“”总结
- velocity判断对象是否为空
- mysql 中 isnull 和 ifnull 判断字段是否为null
- 企业私有云技术设计方案
- Python Numpy的数组array和矩阵matrix
- 第一篇CSDN博客
- 【Java】Jedis连接池使用
- ActiveMQ 即时通讯服务 浅析
- velocity判断是否为null和 “”
- Java读写txt文档内容
- MD5加密类
- FragmentStatePagerAdapter和FragmentPagerAdapter
- angularJS的service理解
- Hadoop安装方法
- MyEclipse配置Tomcat和发布项目
- 在使用selenium webdriver进行元素定位时,通常使用findElement或findElements方法结合By类返回的元素句柄来定位元素。其中By类的常用定位方式共八种,现分别介绍如下
- C++ dynamic_cast 进行强转