就是这点代码,我要跳转到AdminIndex.jsp,可是总跳不过去,是404错误
<%
  String action=request.getParameter("action");
  if(action!=null&&action.equals("check"))
  {
    String username=request.getParameter("username");
    String password=request.getParameter("password");
    if(!"admin".equals(username))
    {
      out.println("用户名不对");
      return ;
    }
    else if(!"admin".equals(password))
    {
      out.println("密码不对");
      return ;
    }
      session.setAttribute("admin","admin");
      response.sendRedirect("admin/AdminIndex.jsp");
    
  }
%>
把错误贴一下
HTTP Status 404 - /Shopping1/admin/AdminIndex.jsp--------------------------------------------------------------------------------type Status reportmessage /Shopping1/admin/AdminIndex.jspdescription The requested resource (/Shopping1/admin/AdminIndex.jsp) is not available
不理解的是这个路径明明是对的,为什么还说是404找不到啊
我的项目就是Shopping1,然后里面有个folder是admin,admin里面也有这个AdminIndex.jsp文件啊
就教指点!

解决方案 »

  1.   

    你忘记了"/"   response.sendRedirect("/admin/AdminIndex.jsp");试一下 
    不行就
    request.getRequestDispatcher("/admin/AdminIndex.jsp").forward(request,response);再试一下
    如果一切还不可以  就检查一下你的环境吧
      

  2.   

    楼上这位不对,前面加/的话就更错了
    HTTP Status 404 - /admin/AdminIndex.jsp--------------------------------------------------------------------------------type Status reportmessage /admin/AdminIndex.jspdescription The requested resource (/admin/AdminIndex.jsp) is not available.
      

  3.   

          response.sendRedirect("admin/AdminIndex.jsp"); 
    ->
          response.sendRedirect(request.getContextPath+"/admin/AdminIndex.jsp"); 
    后面要不要第一个/,两个都试下。
      

  4.   

    就是一个路径问题 啊    /Shopping1/admin/AdminIndex.jsp 有这个页面么?
      

  5.   

    问题解决没有啊,要不试试这样写(/Shopping1/admin/AdminIndex.jsp)多试几次就会勒,进步就是这样的。
      

  6.   

    5楼说的我试过了,10楼的也试过了,都不好使
    很奇怪的是我在地址栏直接打http://localhost:8080/Shopping1/admin/AdminIndex.jsp
    这样也出现404错误,但是
    我的项目就是Shopping1,然后里面有个folder是admin,admin里面也有这个AdminIndex.jsp文件啊
    怎么回事呢?
      

  7.   

    我问一下你首先建AdminIndex.jsp名字是AdminIndex,还是只后改成这个名字的啊。
    如果是改成这个名字的话,那你还是改成首先建的那个名称吧,
    我做项目就出现过这样的问题啊。