请求如果是AJAX则跳转失效,需要用浏览器普通的请求访问才起作用。

解决方案 »

  1.   

    debug一下!看看程序执行response.sendRedirect("login.jsp");吗? 
      

  2.   

    只是普通的jsp 和js脚本没有用到ajax
      

  3.   

    还是不会跳转!不知什么情况,都是空值了,怎么就不跳转呢就是程序执行了!但是没有跳转吗????没有报错吗???
    报错了,但是是因为shopcar是空才报错,我意图就是拦截空值的。我从正常页面进去就不会报错,正常页面是put key和value进shopcar集合的
      

  4.   


    好像是那个页面问题,但是我不知道有没有用ajax,就是我的登录页,有js的onSubmit判断用户登录的密码和账号是否为空,我换了个页面好像可以跳,请问该怎么解决吗,我就是要跳到那个页去的,不能换的
      

  5.   

    //这个是我要请求的页面,就是不给我跳转
    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="UTF-8"%>
    <html>
    <head>
    <title>美食街&mdash;你最爱的美食</title>
    <style type="text/css"><!--
    a:link,a:visited{ 
     text-decoration:none;  /*超链接无下划线*/ 

    a{color:black;}
    a:hover{ 
     text-decoration:underline; 

    .box {
    margin:auto
    height: 1000px;
    width: 1300px;
    height: auto;
    }
    .zuopiaofu {
    float: right;
    margin-right: 150px;
    height: 260px;
    width: 345px;
    margin-top: 110px;
    background-image: url(images/webbase/longin-right.gif);
    border: 1px solid #F00;
    background-repeat: no-repeat;
    background-color: #FEFAFA;
    }
    .loginbotton {
    margin-left: 60px;
    margin-top: 10px;
    }
    .logintable {
    margin-top: 68px;
    left: 701px;
    top: 63px;
    }
    .zuopianfutrue {
    float: left;
    margin-top: 70px;
    margin-left: 50px;
    }.bottom {
    background-image: url(images/webbase/loginbotttombg.jpg);
    height: 175px;
    width: 1300px;
    text-align: center;
    }
    .foot {
    text-align: center;
    display: block;
    }
    .main {
    height: 977px;
    width: 1300px;
    text-align: center;
    }
    body {
    background-image: url(images/webbase/loginbg.gif);
    background-repeat: repeat;
    }
    </style></head>
    <body>
    <center>
    <div class="box"><div class="main">
      <div class="zuopianfutrue"><img src="images/webbase/login_left.jpg" width="393" height="300"></div>
      <div class="zuopiaofu">
      
       <form  action="loginCheck.jsp"  method="post" onSubmit="return onclickFun();">
    <table width="342" height="106"class="logintable">

    <tr>
    <td width="103" height="52">&nbsp;</td>
      <td width="229" height="52"><input height="38" name="loginname" type="text" id="name" value="[email protected]"></td>
    </tr>
    <tr>
     
                    <td height="52">&nbsp;</td>
      <td><input height="38" type="password" id="pwd" name="password" value="123456"></td>
        </tr>
    </table>
            <table>
     <tr>
             
    <td> <div class="loginbotton"> <center>
       <input name="button" type="image" id="button"  value="提交" src="images/webbase/login_button.gif" align="top">
    </center> </div></td>
      </tr><tr><td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<% String message=(String)request.getAttribute("message");
     //String message1=(String)request.getParameter("m");
    if(message!=null&&!message.equals("")){%>
    <font color="red"><%=message%></font>
    <%}
    %><a href="register.jsp">注册</a></td></tr></table>
    </form>
      
      </div>
    </div>
    <div class="foot">
      <tr>
    <td height="20" >&nbsp;</td>
    </tr>
    <tr>
    <td height="177" align="center">
      <div class="bottom"><table width="1282" height="180" class="weibuziti"><tr>
        <td width="539" height="63"></td>
        <td width="720">首页&nbsp;&nbsp;|&nbsp;&nbsp;美食区&nbsp;&nbsp;|&nbsp;&nbsp;活动专区&nbsp;&nbsp;|&nbsp;&nbsp;关于我们&nbsp;&nbsp;|&nbsp;&nbsp;联系我们</td>
      </tr>
          <tr>
            <td height="109"></td>
            <td align="right" valign="top"><font color="black"><strong><a href="#top">↑<br>
              回<br>
              到<br>
              顶<br>
              部</a></strong></font></td>
              </tr>
      </table>
      </div></td>
    </tr></div></div>
    </center>
    <script type="text/javascript">
    function onclickFun(){
    var name=document.getElementById("name");
    var pwd=document.getElementById("pwd");
    if(!name.value||!pwd.value){alert("用户名或密码不能为空");return false; }
    else{return true;}
    }
    onclickFun();
    </script>
    </body>
    </html>
      

  6.   

    response.sendRedirect("login.jsp"); 在这句后面加return;