校验完的信息就是放在ActionErrors里面,可以不在当前页显示。你要在显示的页加上<html:errors/>

解决方案 »

  1.   

    记得在ApplicationResources.properties文件中定义errors
      

  2.   

    //±í&Ecirc;&frac34;&micro;&atilde;&raquo;÷&Iuml;&micro;&Iacute;&sup3;&sup1;&Uuml;&Agrave;í°&acute;&Aring;&yen;&pound;&not;×&ordf;&Iuml;ò&Iuml;à&Oacute;&brvbar;&micro;&Auml;&Ograve;&sup3;&Atilde;&aelig;
         if(isForward(loginForm)==2){
           try{
             httpServletRequest.setAttribute("userName",loginForm.getUserName());
             return (actionMapping.findForward("success_system"));
           }catch(Exception ex){
             System.out.println("&Iuml;&micro;&Iacute;&sup3;&sup1;&Uuml;&Agrave;í&Ograve;&sup3;&Atilde;&aelig;×&ordf;&Iuml;ò&acute;í&Icirc;ó" + ex.getMessage());
           }
          }
          //×&ordf;&Iuml;ò&acute;í&Icirc;ó&micro;&Auml;&micro;&Ccedil;&Acirc;&frac14;&Ograve;&sup3;&Atilde;&aelig;
       ActionErrors errors = new ActionErrors();
       ActionError error = new ActionError("login.error");
       errors.add(ActionErrors.GLOBAL_ERROR,error);
       saveErrors(httpServletRequest,errors);
    在jsp中写
    <logic:messagesPresent>
        <html:messages id="error">
      <li><c:out value="${error}"/></li>
    </html:messages>
    <hr>
    </logic:messagesPresent>
    就可以获取错误的信息
      

  3.   

    据我测试是不可以现在在其他页面的
    CoolAbu说的是肯定不能显示的
      

  4.   

    如果是用saveError应该是只能在本页面显示。本身,saveError方法就是父类的方法。我的错误是利用异常抛出的,可以在其它的页面显示。