LoginAction.java里的部分代码:
ActionError error =  new ActionError("web.error.username");
errors.add(ActionErrors.GLOBAL_ERROR, error);
saveErrors(request, errors);
return new ActionForward(map.getInput());
---------------------------------------------------------
login.jsp里的部分代码:
<tr>
<td align="right"  width="40%">
<bean:message key="web.TipsOfPassword"/>
</td>
<td>
<html:password property="password" size="15" maxlength="15"/><html:errors/>
</td>
</tr>
-----------------------------------------------------------
application.properties里的代码,已经转换了编码
web.Title=\u5b66\u751f\u4fe1\u606f\u7ba1\u7406\u7cfb\u7edf
web.TipsOfUsername=\u7528\u6237\u540d
web.TipsOfPassword=\u5bc6\u7801
web.error.username=\u7528\u6237\u540d\u9519\u8bef
web.error.password=\u5bc6\u7801\u9519\u8bef
资源文件里的其他消息都可以显示,应该不是资源文件的问题```试了很久``还是没解决``我试过把ActionErrors换成ActionMessages,把ActionError换成ActionMessage``都不行``真不知道是什么原因了求教啊`

解决方案 »

  1.   

    ActionMessages errors = new ActionMessages();
        errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("error", msg));
        saveErrors(request, errors);
        return mapping.findForward("error");
      

  2.   

    顶,请问楼上的那段代码中的msg是哪里来的?
      

  3.   

    如此``。。你的方法我也试过了``我几乎把ActionMessages和ActionErrors所有的组合都试过了``都是不行郁闷啊``这个问题已经拦住我一个多星期了还是没解决``有哪位大哥能帮帮忙啊
      

  4.   

    用这个,保管成功,给分啰……^-^
    ActionErrors errors=new ActionErrors();  errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("web.error.username"));
    saveErrors(httpServletRequest,errors);    return actionMapping.getInputForward();
      

  5.   

    这里是jsp代码
    <%@ page contentType="text/html; charset=GBK" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:html>
      <head>
        </head>
        <body>
          <html:errors/>
      
          </body>
    </html:html>
      

  6.   

    return actionMapping.getInputForward();
    你没试过这个吧
      

  7.   

    Actionerrors errors =new Actionerrors()
    /
    Actionmessage message=new Actionmessge()
    组合能好用