1.对于spring中利用ModelAndView以及session传递到页面上的键值对,在页面中只需${key值} 显示其内容即可;
2.if……else的使用
<#if !memberId?exists>
*********
</#if>
注: !表示否定的意思,上述意思是如果memberId不存在则执行中间的内容。
3.页面中list的循环
<#list strList as str>
${str}
</#list>
4.判断参数是否存在,存在则输出某个值
${avatarUrl!"http://jfbbs.tomoya.cn/static/img/default_avatar.png"}
(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