String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String mypath = basePath + "sysaction/price!backAddSysprice.action"; RequestDispatcher   dispatcher   =   request.getRequestDispatcher("/"+mypath);
dispatcher.forward(request, response);Debug中查到这样:请问为何:为何 最下面为何多了/sysaction/?
request.getRequestDispatcher(url)url参数需要是"/资源",于是把它改为:        RequestDispatcher   dispatcher   =   request.getRequestDispatcher("/"+mypath);这时Debug中查到这样:FF中报的:
请问我改如何正确转向:sysaction/price!backAddSysprice.action 呀?!URL 转向

解决方案 »

  1.   

    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    String mypath = basePath + "sysaction/price!backAddSysprice.action";RequestDispatcher   dispatcher   =   request.getRequestDispatcher("/"+mypath);
    dispatcher.forward(request, response);还有debug里面的信息,已经很明显了。
      

  2.   

    to fangmingshijie:是action的namespace配置不对吗?您上面这段代码我看不错有什么不同哟
      

  3.   

    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    String mypath = basePath + "sysaction/price!backAddSysprice.action";
    不是你自己加上去的吗?
      

  4.   

    request.getRequestDispatcher("a/b"+mypath);
    你改成这样然后再用Debug看看
    或者改成这样试试request.getRequestDispatcher("/price!backAddSysprice.action");
      

  5.   

    request.getRequestDispatcher("/price!backAddSysprice.action")接收的是相对于当前web应用的URL
      

  6.   

    request.getRequestDispatcher("/");
    这是转向根目录的。
    request.getRequestDispatcher("/"+mypath);
    同理是转到根下的其他路径(mypath)。你的mypath已经包含根了,当然不对。
      

  7.   

    把你的basePath去掉就行. 
    不同的服务器不能forward.
    同一服务器不需要加入前面那些
      

  8.   

    首先这是为什么会多一个“/sysaction/”的原因,这是你自己添加的:String mypath = basePath + "sysaction/price!backAddSysprice.action";
    404错误就是路径错误,转发和重定向的跳转路径有时候会不一样的,要仔细分析。
    你这里是通过action进行跳转的,看看action里面的配置是否有namespace。如果有的话,加入到路径就可以了。
      

  9.   

    RequestDispatcher   dispatcher   =   request.getRequestDispatcher("/"+mypath);
    去掉"/"