问题是这样的:我们在开发一个权限管理系统,刚刚做了登录和注册,在模块调试的时候我发现,登录功能是没有问题,但登录进去后,没过多长时间又有一个重复的action请求(登录)发送到了action  导致异常。可我并没有做任何的请求动作,可以肯定的是后台自动把请求提交给了action。这是为什么呢?请各位帮我找下原因以及解决办法,谢过!另高分送上!

解决方案 »

  1.   

    贴JSP页面代码,action代码,Struts.xml代码!
      

  2.   

    后台还能没事就自动重复提交登录请求?这事情听起来有点玄幻了。你登录请求的提交,是表单POST,还是用Ajax的?
      

  3.   

    jsp代码
     <form action="employee_toLogin" method="post">
                            <table cellSpacing="0" cellPadding="0" width="100%" border="0" height="143" id="table212">
                              <tr>
                                <td width="13%" height="38" class="top_hui_text"><span class="login_txt">帐号:&nbsp;&nbsp; </span></td>
                                <td height="38" colspan="2" class="top_hui_text"><input name="user_name" class="editbox4"  size="20">                            </td>
                              </tr>
                              <tr>
                                <td width="13%" height="35" class="top_hui_text"><span class="login_txt"> 密 码: &nbsp;&nbsp; </span></td>
                                <td height="35" colspan="2" class="top_hui_text"><input class="editbox4" type="password" size="20" name="user_password">
                                  <img src="images/luck.gif" width="19" height="18"> </td>
                              </tr>
                              <tr>
                                <td width="13%" height="35" ><span class="login_txt">验证码:</span></td>
                                <td height="35" colspan="2" class="top_hui_text"><input class=wenbenkuang name=verifycode type=text value="" maxLength=4 size=10>
                                  </td>
                              </tr>
                              <tr>
                                <td height="35" >&nbsp;</td>
                                <td width="20%" height="35" ><input name="Submit" type="submit" class="button" id="Submit" value="登 陆"> </td>
                                <td width="67%" class="top_hui_text"><input name="cs" type="button" class="button" id="cs" value="取 消" onClick="showConfirmMsg1()"></td>
                              </tr>
                            </table>
      

  4.   

    action代码 public String toLogin(){

     HttpServletRequest request=ServletActionContext.getRequest();
    String name=request.getParameter("user_name").trim().toLowerCase();
    String password=request.getParameter("user_password").trim().toLowerCase();

    if(name.equals("admin")&&password.equals("admin")){
    request.getSession().setAttribute("admin", "admin");
    return "login_success";
    }

    Employee employee=new Employee(name,MD5.md5crypt(password));
    employee=this.service.login(employee);

    if(employee!=null){
    request.getSession().setAttribute("user",employee);
    return "login_success";
    }else{
    return ERROR;
    }

    }
      

  5.   

    struts.xml代码     <action name="employee_*" class="cn.jbit.action.EmployeeAction" method="{1}">
         <result name="login_success">main.jsp</result>
         <result name="error">error.jsp</result>
         <result name="exit">login.jsp</result>
         <result name="register_success">index.jsp</result>
         <result name="SearchEmployeeByPage">employee_list.jsp</result>
         </action>
      

  6.   

    去掉action代码的这样的两句试试。request.getSession().setAttribute("user",employee);
      

  7.   

    登录成功到了main.jsp页面,你说的重复提交难道是又自动跑到login.jsp页面进行了一次表单提交吗?
    会不会是你调试的时候设置了什么啊?
      

  8.   

    是不是 哪个页面上写了 每隔一段时间固定刷新一次  为了防止 用户session过期呀
      

  9.   

    但登录进去后,没过多长时间又有一个重复的action请求(登录)发送到了action 导致异常你把异常代码贴出来吧.