struts2中<s:if>标签的使用
来源:互联网 发布:森海塞尔 cx275s 知乎 编辑:程序博客网 时间:2024/05/01 20:48
A:<s:if>判断字符串的问题:
1、判断单个字符:<s:if test="#session.user.username=='c'">
这样是从session中取出username的值,并且判断其是否为c,但是这样判断是不正确的,这样判断的话,根本判断不出来,要改成下面这样:
<s:if test="#session.user.username=='c'.toString()">
这样判断才能正确判断,至于原因我也不知道,在网上看到struts2中可能它判断的是char类型。
2、判断字符串:<s:if test="#session.user.username=='milo'">
这样写的就是判断username是不是milo,是String的判断,这个是不用加toString()的。
3、判断数值:<s:if test="#session.user.username==0">
这样写的就是判断username是不是0,是int的判断。
B:判断为空的问题:
<s:if test="#session.user.username==null">
struts2中的判空似乎只能这么写
判断非空可以这样写:
<s:if test="#session.user.username!=null" >
举例:
<s:set name="name" value="model.userId" />
- struts2中<s:if>标签的使用
- struts2中<s:if>标签的使用
- struts2中<s:if>标签的使用
- struts2中<s:if>标签的使用
- struts2的s:if标签的使用
- struts2 s:if标签中 #,%{},%{#}的使用方法
- struts2 标签的使用之一 s:if
- struts2 标签的使用之一 s:if
- struts2 标签的使用之 s:if
- struts2 标签的使用之一 s:if
- struts2 标签的使用之一 s:if
- Struts2 标签的使用之 s:if
- struts2 标签的使用之一 s:if
- Struts2 标签的使用之 s:if
- Struts2 -- s:if标签的使用
- struts2 标签的使用之一 s:if
- struts2 标签的使用之一 s:if
- struts2 标签的使用之一 s:if
- 【BZOJ4318】OSU!【期望DP】
- sharedPreferences的相关用法介绍
- How to install Tomcat 8 on a CentOS 6 VPS
- hdu1452 Happy 2004(规律+因子和+积性函数)
- Android内存泄露案例分析
- struts2中<s:if>标签的使用
- hdoj2008/hdoj2009/hdoj2010/hdoj2011/hdoj2012
- android 权限管理的使用
- iOS FMDB数据库基本操作
- 避免Android内存泄露
- struts文件上传和表单校验
- PHP设计模式之——单例模式
- IE浏览器单独兼容写法
- 拖延症