利用html:error和html:message标签实现信息提示需要做三方面的处理:
1.jsp页面中的代码片断:
<table width="100%" align="left" border=0>
<tr align="left">
<td colspan="2" nowrap><span class="ErrorStyle"><html:errors/></span></td>
</tr>
</table>2.action中处理的方式:
String errMsg="数据库运行异常,请重新操作!";
Tools.set_Error(errMsg,httpServletRequest);
Tools中的set_Error代码部分
public static void set_Error(String errMsg,HttpServletRequest httpServletRequest)

...{
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("cfy.public.error",errMsg));
httpServletRequest.setAttribute("org.apache.struts.action.ERROR", errors);
}
3.在\WebModule\WEB-INF\classes路径下新建文件ApplicationResources.properties,内容如下:
cfy.public.error=错误:{0}
cfy.public.message=提示:{0}
4.在struts-config.xml文件中添加如下配置信息:
<message-resources parameter="ApplicationResources_zh_CN" />
1.jsp页面中的代码片断:







Tools中的set_Error代码部分








cfy.public.error=错误:{0}
cfy.public.message=提示:{0}
4.在struts-config.xml文件中添加如下配置信息:
<message-resources parameter="ApplicationResources_zh_CN" />