`
kong0itey
  • 浏览: 299289 次
社区版块
存档分类
最新评论

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>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics