response.sendRedirect("index.jsp"); 已经重定向到另一个页面,当然不会弹出了

解决方案 »

  1.   

    response.sendRedirect("index.jsp"); 不要这句话~~~
      

  2.   

    out.println是打印
    document.write(" <script> alert('没有登录'); </script>"); 
      

  3.   

    out.println(" <script> alert('没有登录'); location.href="index.jsp"</script>"); 
      

  4.   

    改成
    <% Object obj=session.getAttribute("isLog"); 
    System.out.println(obj);
    if(obj==null)
    {
    out.println("你没有登录,请先登录");
    out.println(" <script> alert('没有登录');window.location = 'index.jsp'; </script>");
    System.out.println("----->"+obj);