action默认方法应该是excute方法。

解决方案 »

  1.   

    谢谢 laz110058(lazy) ,action默认方法应该是excute方法。
    修改运行后,得到了一个异常:java.lang.NoSuchMethodError: org.apache.struts.action.ActionErrors.empty()Z
    我得excute方法是:
    public ActionForward execute(ActionMapping actionMapping,
                                   ActionForm actionForm,
                                   HttpServletRequest httpServletRequest,
                                   HttpServletResponse httpServletResponse) {
        /**@todo: complete the business logic here, this is just a skeleton.*/
        System.out.println("excute at LogonAction...");
        LogonForm logonForm = (LogonForm) actionForm;
        ActionErrors errors=new ActionErrors();
        if(logonForm.getUsername().equals("france")&&logonForm.getPassword().equals("123456")){
          return actionMapping.findForward("success");
        }else if(logonForm.getUsername().equals("france")){
          errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.login.password"));
        }else{
          errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.login.username"));
        }
        if(!errors.empty()){
          saveErrors(httpServletRequest,errors);
        }
        return actionMapping.findForward("failure");
      }
    请再次帮我指点一下!
      

  2.   

    问题解决了,是没有empty()方法
    谢谢各位!