没遇到有这样的问题啊,不过你可以试下request对象里的getRequestDispatcher,

解决方案 »

  1.   

    request里的也试过了,同样的问题。
      

  2.   

    由forward转发过去的jsp页面,当jsp页面显示的时候其url还是servlet的路径,你的servlet是在根路径 下,所以jsp页面的图片和css都必须从根站点下引用才可以找到,你也可以用response.sendRedirect()方法。
      

  3.   

    你也可以在web.xml中把servlet映射到和所要转发的jsp的同一目录下面,这样当转发过去以后前url位置就是jsp文件的当前位置,image和css引用不用变。
    eg:
    站点墟拟路径:http://localhost/test,
    a.jsp的位置:http://localhost/test/manage/a.jsp
    servlet映射:
    <servlet-mapping>
    <servlet-name>testservlet</servlet-name>
    <url-pattern>/manage/testservlet</url-pattern>
    <servlet-mapping>servlet转发:
    RequestDispatcher dis=request.getRequestDispatcher("a.jsp");
    dis.forward(request,response);
    现在地址栏的url虽然没有变,但实际路径已经在http://localhost/test/manage/下。请求servlet的链接:<a href="/manage/testservlet">click me</a>
      

  4.   

    可以按照 hj821003(荒原小草) 说的,
    把 getServletConfig().getServletContext().getRequestDispatcher(path).forward(req,resp)
    换成 response.sendRedirect( path )或者 在你的 jsp 文件中的 jpg、js 等都是用绝对路径,
    如: n_top1.jpg 改成 /images/n_top1.jpg
      

  5.   

    主要是forward转发的页面都只是从当前页面所在目录开始找的。所以支持用绝对路径