当一个请求提交到服务器后,服务器进行处理,若输入错误或者进行提示,需要返回原输入页面将错误信息呈现给用户....

具体实现:

ApplicationResources.properties
====================================
# Resources for parameter 'com.lhcard.struts.ApplicationResources'
# Project LhCard


geren.userlogin.error.authencode=<font color="red">\u9a8c\u8bc1\u7801\u9519\u8bef</font>
geren.userlogin.error.password=<font color="red">\u5bc6\u7801\u9519\u8bef</font>
geren.userlogin.error.name=<font color="red">\u6ca1\u6709\u6b64\u7528\u6237</font>




geren.regisgter.error.name=<font color="red">\u6b64\u7528\u6237\u540d\u5df2\u88ab\u4eba\u6ce8\u518c\uff0c\u8bf7\u66f4\u6362\u4e00\u4e2a</font>


action:
=====================
ActionMessages messages = new ActionMessages();
messages.add("exist_name", new ActionMessage(
"geren.regisgter.error.name"));
request.setAttribute("msg", messages);
return mapping.findForward("reg");


jsp页面:
===========================
<html:messages id="c" name="msg" property="exist_name">
${c } </html:messages>

此标签中的name属性指定request作用域中的key,property指定错误消息的key
评论
发表评论

您还没有登录,请登录后发表评论

weiweichen1985
搜索本博客
我的相册
E6c390da-d0cb-3350-97d4-83ec6586912c-thumb
2008-6-26
共 122 张
存档
最新评论