首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

struts2参数比较不相等的缘故(原创)

2012-06-27 
struts2参数比较不相等的原因(原创)http://localhost:8080/lowcaActivity/register.jsp?usertype1这个页

struts2参数比较不相等的原因(原创)
http://localhost:8080/lowcaActivity/register.jsp?usertype=1
这个页面上有一个判断
<s:if test="#parameters.usertype==1">true</s:if>
发现得不到true

于是,把判断条件改成
<s:if test="#parameters.usertype=='1'">true</s:if>
依旧得不到true

经过检查,发现原来#parameters.usertype是一个数组类型,于是改成
<s:if test="#parameters.usertype[0]=='1'">true</s:if>
得到了true

也可以写成
<s:if test="%{#parameters.usertype[0]=='1'}">true</s:if>

热点排行