1.在首页登陆用户名,密码,验证码都正确,但是登陆不了,action中也打印出用户名,密码,验证码都正确; 
但是在其他页面的这个登陆入口用户名,密码,验证码可以登陆, 很明显了,你在首页登陆不上,但是在其他页面可以。证明不是你action代码的问题
是你的首页传到action参数的问题,
String url=request.getParameter("url"); 
String id=request.getParameter("id"); 
String username=request.getParameter("username"); 
String psd=request.getParameter("password"); 
String checkCode=request.getParameter("checkCode"); 
首页是否正确传递过来这几个参数了呢?2.当登陆不正确时不会跳转到return mapping.findForward("loginFailure"); 
这个,估计就不必说了吧,配置文件写好路径即可

解决方案 »

  1.   

    其他页面能登录 说明你的action处理应该是没有问题的
    仔细坚持一下jsp页面的参数名称 struts的配置文件 
      

  2.   

    我测试userid已经放到session中了,但是就是首页去不到,
      

  3.   

    。。那你检查你的userid为什么传不过去呀~~
    和struts一点关系都没有,更不用说ajax咯
      

  4.   

    我测试userid已经放到session中了,但首页页面却的不到userid
      

  5.   

    <%@ page language="java" contentType="text/html; charset=utf-8" import="java.util.*"%>
    <%@page  import="com.innoing.hiberfactory.user.dao.UserDAO,com.innoing.common.entity.User,
    com.innoing.hiberfactory.friendlink.dao.FriendLinkDAO,com.innoing.common.entity.FriendLink;"%>
    <%
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragrma","no-cache");
    response.setDateHeader("Expires",0);
    %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link href="<%=request.getContextPath() %>/css/system.css" rel="stylesheet" type="text/css" />
    <link href="<%=request.getContextPath() %>/loginForward/top.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>创新风暴</title>
    <script language="JavaScript" type="text/JavaScript" src="">
    function register(username,password,checkCode){


    var xmlHttp;
    try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }catch(e){
    try{
    xmlHttp = new XMLHttpRequest();
    }catch(e){
    alert("该版本,不支持当前浏览器!");
    }
    }
    xmlHttp.open("POST","<%=request.getContextPath()%>/Top.do?method=topLogon&username="+username+"&password="+password+"&checkCode="+checkCode,false);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlHttp.send(null); 
    var resultInfo=xmlHttp.responseText;
        document.userform.getElementById("results").innerHTML=xmlHttp.responseText;
    }
    </script>
    </head>
    <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" valign="top"><div align="left">
          <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C9C4ED">
            <tr>
              <td height="20" valign="top" bgcolor="#FFFFFF">
              
              <form  name="userform" method="post" action="" 
               onSubmit="register(userform.username.value,userform.password.value,userform.checkCode.value)">
              <input type="hidden" name="url" value="<%=request.getRequestURL() %>">
               <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1">
                  <tr>
                    <td valign="top">
                    
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <%
      
    if(session.getAttribute("userid")==null){          
       %>
                <span id="results"></span>     
                      
                      <tr>
                        <td width="6"></td>
                        <td width="99" align="center" valign="middle" ><div align="left">
                          <input type="text" name="username"  class="search_login" value="用户名" onFocus="this.value=''" onblur='if (value ==&quot;&quot;){value=&quot;用户名&quot;}'size="13"  height="15"/>
                        </div></td>
                        <td width="102" align="center" valign="middle"><div align="right">
                          <input type="password" name="password"  class="search_login" value="密码" onFocus="this.value=''" onblur=' if(value==&quot;&quot;){value=&quot;密码&quot;}' size="13"  height="20"/>
                        </div></td>
                        <td width="75"><div align="center">
                          <input name="Submit" type="submit" class="login" value="登陆" />
                        </div></td>
                        <td width="16">&nbsp;</td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td valign="top">                
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
     
                      <tr>
                        <td width="6"></td>
                        <td width="99" align="center" valign="middle"><div align="left">
                          <input type="text" name="checkCode"  id="checkCode"  class="search_login" value="验证码" onFocus="this.value=''" onblur=' if(value==&quot;&quot;){value=&quot;验证吗&quot;}' size="13" maxlength="10" />
                        </div></td>
                        <td height="25" valign="bottom">
                      
                       &nbsp;&nbsp;
                       <span style="align:buttom">
                       <img src="<%=request.getContextPath() %>/ImageCaptcha" id="imageCaptcha" title="如看不到请点击刷新" style="cursor: pointer;"/>
                      
    </span>
    <div color="red" id="err_checkCode"></div>
                       </td>
                        <td width="83"><a href="<%=request.getContextPath() %>/user/user_register.jsp">注册</a></td>
                        <td width="16">&nbsp;</td>
                      </tr>
       <%}
     //判断是否已经登陆

    else{          
    Integer userid =(Integer)session.getAttribute("userid");
       User user=new User();
    UserDAO userDao= new UserDAO();
    user = userDao.findById(userid);
    String username=user.getUsername();
      
      %>     
                      <tr >
                      <td colspan="3"><%=username+",您好!"+"("+user.getSrcscore() %><img src="<%=request.getContextPath() %>/topImage/gold.jpg" >)<br>
                     [<a href="<%=request.getContextPath() %>/user/infoissue/manageInfo.jsp">用户中心</a>]&nbsp;&nbsp;&nbsp;[<a href="<%=request.getContextPath() %>/Top.do?method=UserLogOut&userid=<%=userid %>">注销</a>]
                      
                      
                      
                      </td>
              
      

  6.   

    上面时调用ajax代码,帮忙看看,快要疯了
      

  7.   

    method=topLogon&username="+username+"&password="+password+"&checkCode="+checkCode,false); username password等值你先在本页测试是否正确再跳转action