struts2 的<s:actionMessages/>标签
2012-08-02 22:08
323 查看
在struts2开发中,我们常常会通过Action 的addActionMessage("xxxxxxxx")方法添加操作提示信息,然后在页面上通过标签<s:actionmessage/>来展现,若需要判断actionMessages中是否有值是可以通过hasActionMessages()方法来判断。
例如:
action中
this.addActionMessage("该用户名已经存在");
jsp中
<s:if test="hasActionMessages()">
你好
</s:if>
<s:actionmessage/>
显示结果:
你好
该用户名已经存在
例如:
action中
this.addActionMessage("该用户名已经存在");
jsp中
<s:if test="hasActionMessages()">
你好
</s:if>
<s:actionmessage/>
显示结果:
你好
该用户名已经存在
相关文章推荐
- struts2 <s:action>标签的用法
- 使用struts2的<s:param>等标签向action传值出现中文乱码的解决方法
- 普普通通html中<form>标签和struts2中<s:form>标签action属性的不同
- Struts2中<s:action/>标签的动态调用
- Struts2中的<s:action>标签
- Struts2 ognl <s:action.../>标签详解(两种实现方式)
- struts2 <s:action>标签的用法
- ssh错误总结1.1----关与struts2中极为恶心的<s:action>标签问题
- Struts2中的<s:action>标签
- struts2 <s:action>标签的用法
- struts2中<s:if>标签的使用
- struts2 标签之<s:property />
- struts2 标签<s:fielderror>
- struts2中<s:select>标签的使用
- struts2 用标签 <s:property value='[]'/> 取值 json 含有转义字符的解决方法
- struts2标签之<s:fielderror>
- struts2配置web的action中的<url-pattern>
- struts2标签<s:param>说明
- Struts2项目<s:debug>标签的问题
- struts2 <s:property/>标签的使用--输出时间格式转换