struts 标签 HTML:MESSAGES和HTML:ERRORS 用法简例
2009-05-07 16:11
447 查看
(1)<html:messages> 使用
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.addMessages(request,message);
return ActionForward;
JSP 页面中 :
<html:messages id=" 指定使用消息的标识 " property=" 消息句柄 " message="true|false">
<bean:write name=" 以上所指 ID 标识 "/>
</html:messages>
(2)<html:errors>使用
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.saveErrors(request,message);
return ActionForward;
JSP 页面中 :
<html:errors property=" 消息句柄 "/>
如果Action中这样设定(false),页面的提示信息将不从资源文件里读取:
ActionMessages message = new ActionMessages();
message.add("消息句柄",new ActionMessage("String类型描述信息));",false));
this.saveErrors(request,message);
return ActionForward;
JSP页面:
<html:errors/>或<html:errors property="消息句柄"/>
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.addMessages(request,message);
return ActionForward;
JSP 页面中 :
<html:messages id=" 指定使用消息的标识 " property=" 消息句柄 " message="true|false">
<bean:write name=" 以上所指 ID 标识 "/>
</html:messages>
(2)<html:errors>使用
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.saveErrors(request,message);
return ActionForward;
JSP 页面中 :
<html:errors property=" 消息句柄 "/>
如果Action中这样设定(false),页面的提示信息将不从资源文件里读取:
ActionMessages message = new ActionMessages();
message.add("消息句柄",new ActionMessage("String类型描述信息));",false));
this.saveErrors(request,message);
return ActionForward;
JSP页面:
<html:errors/>或<html:errors property="消息句柄"/>
相关文章推荐
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- [struts]HTML:MESSAGES和HTML:ERRORS用法简例
- Struts 中 Html 标签库 的用法(第二组标签,与Form相关的标签 )
- Struts 中 Html 标签库 的用法(第二组标签,与Form相关的标签 )
- Struts 中用Html 标签库的用法(第一部分)
- [转][struts]标签 HTML:MESSAGES和HTML:ERRORS用法简例
- <html:messages id=””>标签和<html:errors/>标签
- html:errors标签与ActionMessage和Struts资源文件指南
- html:messages 标签用法之一
- 关于html:errors与html:messages标签的问题
- <html:messages id="">标签 <html:errors/>标签
- html:errors标签与ActionMessage和Struts资源文件指南
- 只介绍 Struts 中 Html 标签库 的用法(第二组标签,与Form相关的标签 )
- 只介绍Struts 中用Html 标签库的用法(第一部分)