freemarker判断对象是否为null方法
来源:互联网 发布:2017淘宝小类目 编辑:程序博客网 时间:2024/05/22 11:26
对于null,或者miss value,freemarker会报错
!:default value operator,语法结构为:unsafe_expr!default_expr,比如 ${mouse!"No mouse."} 当mouse不存在时,返回default value;
(product.color)!"red" 这种方式,能够处理product或者color为miss value的情况;
而product.color!"red"将只处理color为miss value的情况
??: Missing value test operator ,测试是否为missing value
unsafe_expr?? :product.color??将只测试color是否为null
(unsafe_expr)??:(product.color)??将测试product和color是否存在null
?exists:旧版本的用法
比如:<#if mouse??>
Mouse found
<#else>
No mouse found
</#if>
Creating mouse...
<#assign mouse = "Jerry">
<#if mouse??>
Mouse found
<#else>
No mouse found
</#if>
转载地址:http://www.iocblog.net/static/2007/728.html
!:default value operator,语法结构为:unsafe_expr!default_expr,比如 ${mouse!"No mouse."} 当mouse不存在时,返回default value;
(product.color)!"red" 这种方式,能够处理product或者color为miss value的情况;
而product.color!"red"将只处理color为miss value的情况
??: Missing value test operator ,测试是否为missing value
unsafe_expr?? :product.color??将只测试color是否为null
(unsafe_expr)??:(product.color)??将测试product和color是否存在null
?exists:旧版本的用法
比如:<#if mouse??>
Mouse found
<#else>
No mouse found
</#if>
Creating mouse...
<#assign mouse = "Jerry">
<#if mouse??>
Mouse found
<#else>
No mouse found
</#if>
转载地址:http://www.iocblog.net/static/2007/728.html
- freemarker判断对象是否为null方法
- freemarker判断对象是否为null方法
- freemarker判断对象是否为null的方法
- freemarker判断对象是否为空的方法
- 对象判断是否为null
- 对象判断是否为null
- freemarker判断对象是否为空
- freemarker判断对象是否为空
- freemarker判断对象是否为空
- jQuery_判断jQuery对象是否为null
- OC 判断对象是否为null
- Freemarker判断是否为空
- freemarker判断是否为空
- 【FreeMarker】判断是否为空
- Freemarker判断是否为空
- freemarker判断是否为空
- Java判断对象是否为空(包括null ,"")
- 判断从服务器返回对象值是否为NULL
- 很不错的一款日期输入控件,可以输入当前的时间
- 【非常实用】EXTJS TREE 上下级级联选择扩展方法
- HDU 3374 String Problem (KMP+最大最小表示)
- 黑马程序员_java学习笔记01
- UITableView和UITableViewCell的一些简单用法
- freemarker判断对象是否为null方法
- 最短路
- WORD中汉字字号与磅值的对应
- PHP5.4+IIS7+WINSRV2008 imagepng无法显示图片的问题
- UTableView分组(section)显示数据
- HTML文档加载步骤
- 实现TreeView控件中的单击事件功能
- 不管你喜欢做什么,do it!
- linux mkfs命令参数及用法详解---linux格式化文件系统命令