我在webRoot->idc->report->report_add.jsp页面中用ajax提交到action总是报这错
140 ERROR RequestProcessor:664 - Invalid path /idc/report/report/report_distb was requested
找不出原因,我又在新建一个页面在webRoot->idc->res->MyJsp.jsp页面把report_add.jsp里面ajax部份拷贝到MyJsp.jsp页面下,再来提交就能提交到action.然后我把MyJsp.jsp放到webRoot->idc->report下还是不能提交.请高手们帮我看看是怎么回事.
这是要提交到的action在Struts-config.xml里面的配置
<action 
    path="/report_distb" scope="request"
    type="EasyBSC.controller.action.res.report.ReportDisplayTbAction">
</action>这是我新建的MyJsp.jsp
<%@ page import="java.util.*" contentType="text/html; charset=GBK" %>
<%
    String head=request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
   <title>myjsp</title>
  <link href="<%=head %>/common/css/style.css" type="text/css" rel="stylesheet"/>
  <script language="javascript" type="text/javascript" src="<%=head %>/My97DatePicker/WdatePicker.js">
  </script>
  <script src="<%=head %>/common/inc/main.js" type="text/javascript"></script>
  <script language="javascript">
    var dialog = window.dialogArguments;
    
  </script>
<script type="text/javascript">
   var httpreq = null;
   var selectvalue = null;
   if(window.ActiveXObject){
try{
httpreq = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
httpreq = new ActiveXObject("Microsoft.XMLHTTP");
}
}else if(window.XMLHttpRequest){
try{
httpreq = new window.XMLHttpRequest();
}catch(e1){ }   }
   function callsever(){
   httpreq.open("GET","report_distb.do",true)
   httpreq.onreadystatechange= check;
   httpreq.send(null);
   }
   function check(){
   if(httpreq.readyState == 4){
   if(httpreq.status == 200){
   var html = httpreq.responseText;
   alert(html);
   }
   }else{
  
   }
   }
   </script>
  </head>
  
  <body>
    This is my JSP page. <br>
    <input type="button" id="ok" name ="ok" value="ok" onclick="callsever();">
  </body>
</html>

解决方案 »

  1.   

    路径问题!
    httpreq.open("GET","report_distb.do",true)改为
    httpreq.open("GET","/你的工程名/report_distb.do",true)看看
      

  2.   

    report_add.jsp  ?呢Invalid path /idc/report/report/report_distb was requested 怎么2个report你看是不是路径问题
      

  3.   

    这和jsp没关系,只和路径有关
    httpreq.open("GET","report_distb.do",true) 
    用post,另外你把路径写成绝对路径
      

  4.   

    加工程名和改成POST还是不行
    2009-09-09 14:08:48,750 ERROR RequestProcessor:664 - Invalid path /idc/report/report_distb was requested
      

  5.   

    小妹,你贴粘你的照片看看.........
    哈哈!好看我就回答.....有140错误吗?????????没见过哦~HTTP1xx - Informational100 - Continue. 101 - Switching protocols.2xx - Success200 - OK. The client request has succeeded. 201 - Created. 202 - Accepted. 203 - Non-authoritative information. 204 - No content. 205 - Reset content. 206 - Partial content.3xx - Redirection301 - Moved Permanently 302 - Object moved.  304 - Not modified. 307 - Temporary redirect.4xx - Client Error400 - Bad request. 401 - Access denied. IIS defines a number of different 401 errors that indicate a more specific cause of the error. These specific error codes are displayed in the browser but are not displayed in the IIS log: 
    401.1 - Logon failed.  
    - 401.2 - Logon failed due to server configuration.  
    - 401.3 - Unauthorized due to ACL on resource. 
    - 401.4 - Authorization failed by filter. 
    - 401.5 - Authorization failed by ISAPI/CGI application.  
    - 401.7 – Access denied by URL authorization policy on the Web server. This error code is specific to IIS 6.0. 403 - Forbidden. IIS defines a number of different 403 errors that indicate a more specific cause of the error: 
    403.1 - Execute access forbidden. 
    - 403.2 - Read access forbidden. 
    - 403.3 - Write access forbidden. 
    - 403.4 - SSL required. 
    - 403.5 - SSL 128 required. 
    - 403.6 - IP address rejected. 
    - 403.7 - Client certificate required. 
    - 403.8 - Site access denied. 
    - 403.9 - Too many users. 
    - 403.10 - Invalid configuration. 
    - 403.11 - Password change. 
    - 403.12 - Mapper denied access. 
    - 403.13 - Client certificate revoked. 
    - 403.14 - Directory listing denied. 
    - 403.15 - Client Access Licenses exceeded. 
    - 403.16 - Client certificate is untrusted or invalid. 
    - 403.17 - Client certificate has expired or is not yet valid. 
    - 403.18 - Cannot execute requested URL in the current application pool. This error code is specific to IIS 6.0. 
    - 403.19 - Cannot execute CGIs for the client in this application pool. This error code is specific to IIS 6.0. 
    - 403.20 - Passport logon failed. This error code is specific to IIS 6.0. 404 - Not found. 
    404.0 - (None) – File or directory not found. 
    - 404.1 - Web site not accessible on the requested port. 
    - 404.2 - Web service extension lockdown policy prevents this request. 
    - 404.3 - MIME map policy prevents this request. 405 - HTTP verb used to access this page is not allowed (method not allowed.)  406 - Client browser does not accept the MIME type of the requested page. 407 - Proxy authentication required. 412 - Precondition failed. 413 – Request entity too large. 414 - Request-URI too long. 415 – Unsupported media type. 416 – Requested range not satisfiable. 417 – Execution failed. 423 – Locked error.5xx - Server Error500 - Internal server error.
    - 500.12 - Application is busy restarting on the Web server. 
    - 500.13 - Web server is too busy. 
    - 500.15 - Direct requests for Global.asa are not allowed. 
    - 500.16 – UNC authorization credentials incorrect. This error code is specific to IIS 6.0. 
    - 500.18 – URL authorization store cannot be opened. This error code is specific to IIS 6.0. 
    - 500.100 - Internal ASP error. 501 - Header values specify a configuration that is not implemented. 502 - Web server received an invalid response while acting as a gateway or proxy. 
    - 502.1 - CGI application timeout. 
    - 502.2 - Error in CGI application. 503 - Service unavailable. This error code is specific to IIS 6.0. 504 - Gateway timeout. 505 - HTTP version not supported
      

  6.   

    140 ERROR RequestProcessor:664
    是你的report_distb 页面664行有错误吗?
      

  7.   

    不是,在webRoot->idc->report->MyJsp.jsp页面根本就提交不到action里去,
    webRoot->idc->res->MyJsp.jsp这就能提交进去.
      

  8.   

    httpreq.open("GET","report_distb.do",true) ;
    改为 httpreq.open("GET","<%=head%>report_distb.do",true) ;
      

  9.   

    httpreq.open("GET","report_distb.do",true) ; 
    改为 httpreq.open("GET"," <%=head%>/report_distb.do",true) ; 
    少写了个/
      

  10.   

    会用httpwatch么。报什么错
      

  11.   

    不会,
    2009-09-09 14:55:54,562 ERROR RequestProcessor:664 - Invalid path /report_distb was requested
      

  12.   

    路径问题。你在你的jsp里面添加一个base
    在<html> 之前添加
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    %>然后在<head>标签内部添加:
    <base href="<%=basePath%>"/>如果再有问题我就怀疑是的web.xml配置有问题了
      

  13.   

    还是不行啊!!但是我把MyJsp.jsp移到别的文件中就可提交啊
      

  14.   

    你确定么 随便建个文件夹放进去都能提交 唯独这个路径不行。
    去下个httpwatch 吧 能看到你提交的到底是什么url.
    再把你现在的jsp文件贴我看下
      

  15.   

    我是把MyJsp.jsp托到一个现有的文件夹中去再提交的.
    嗯,我去下个,来看看
      

  16.   

    <%@ page import="java.util.*" contentType="text/html; charset=GBK" %> 
    <% 
        String head=request.getContextPath();     String path = request.getContextPath(); 
        String basePath = request.getScheme() + "://" 
    + request.getServerName() + ":" + request.getServerPort() 
    + path + "/"; 
    %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    <html> 
      <head> 
      <base href=" <%=basePath%>"/> 
      <title>myjsp </title> 
      <link href=" <%=head %>/common/css/style.css" type="text/css" rel="stylesheet"/> 
      <script language="javascript" type="text/javascript" src=" <%=head %>/My97DatePicker/WdatePicker.js"> 
      </script> 
      <script src=" <%=head %>/common/inc/main.js" type="text/javascript"> </script> 
      <script language="javascript"> 
        var dialog = window.dialogArguments; 
        
      </script> 
    <script type="text/javascript"> 
      var httpreq = null; 
      var selectvalue = null; 
      if(window.ActiveXObject){ 
    try{ 
    httpreq = new ActiveXObject("Msxml2.XMLHTTP"); 
    }catch(e){ 
    httpreq = new ActiveXObject("Microsoft.XMLHTTP"); 

    }else if(window.XMLHttpRequest){ 
    try{ 
    httpreq = new window.XMLHttpRequest(); 
    }catch(e1){ }   } 
      function callsever(){ 
      httpreq.open("GET","report_distb.do",true) 
      httpreq.onreadystatechange= check; 
      httpreq.send(null); 
      } 
      function check(){ 
      if(httpreq.readyState == 4){ 
      if(httpreq.status == 200){ 
      var html = httpreq.responseText; 
      alert(html); 
      } 
      }else{ 
      
      } 
      } 
      </script> 
      </head> 
      
      <body> 
        This is my JSP page. <br> 
        <input type="button" id="ok" name ="ok" value="ok" onclick="callsever();"> 
      </body> 
    </html> 
    你覆盖下看看 我就不信还有问题
      

  17.   

    http://download.csdn.net/source/1646542
    下个httpwatch自己看路径吧。
      

  18.   

    下了,现在看 
    result: 404 
    url: http://localhost:8080/EasyBSC/idc/report/report_distb.do你看看
      

  19.   

    function callsever(){ 
      httpreq.open("GET","report_distb.do",true) 
      httpreq.onreadystatechange= check; 
      httpreq.send(null); 
      } 
    路径问题:将这个函数改称
    function callsever(rootpath){ 
      httpreq.open("GET",rootpath+"/report_distb.do",true) 
      httpreq.onreadystatechange= check; 
      httpreq.send(null); 
      } 
    在调用的地方这样调用:callserver(${pageContext.request.contextPath})
    这样就应该可以了。
      

  20.   

    url: http://localhost:8080/EasyBSC/idc/report/report_distb.do
    明显不对 应该请求到
    http://localhost:8080/EasyBSC/report_distb.do
    才正确,难道base对ajax提交url不起作用。你用楼上的方式试试看应该有用。
      

  21.   

    是在不行你据把
    httpreq.open("GET","report_distb.do",true) 
    改成
    httpreq.open("GET","../../report_distb.do",true) 
    向上跳两层总没问题了把
      

  22.   

    <action 
        path="/report_distb" scope="request" 
        type="EasyBSC.controller.action.res.report.ReportDisplayTbAction"> 
    </action> 感觉这有问题,type有问题,
      

  23.   

    <action 
        path="/report_distb" scope="request" 
        type="EasyBSC.controller.action.res.report.ReportDisplayTbAction"> 
    </action> type="EasyBSC.controller.res.report.action.ReportDisplayTbAction"> 
    你把配置文件再整理一下,感觉挺乱的
      

  24.   

    httpreq.open("GET","/report_distb.do",true) 
    就是路径了。
      

  25.   


    我觉得也是这个。
    其实Struts有一个url标签的,用它就不会有这种问题了。
      

  26.   

    1:2009-09-09 14:55:54,562 ERROR RequestProcessor:664 - Invalid path /report_distb was requested
    2:result: 404 
    url: http://localhost:8080/EasyBSC/idc/report/report_distb.do
    这个提示已经很清楚了,无效的请求路径,需要的是/reprot_distb,路径问题。
    -----------------------------------------------------------------------
    当你进入report_add.jsp这个页面时,浏览器的地址其实已经是在/project/idc/report下了
    而你的action配置是path="/report_distb",你要是在根目录下新建一个jsp提交肯定没问题,
    因为都在"/"下 ,而当你进入report_add.jsp时,已经不是在"/"下了,所以肯定地址不对啊
    把你的ajax请求路径改成这样试试吧(reprot_add.jsp页面中):
    httpreq.open("GET","/report_distb.do",true)
    还是不行,qq再联系吧。
      

  27.   

    我看过了 这个问题确实比较诡异。跳两层后 路径访问到
    http://localhost:8080/EasyBSC/report_distb.do 还是报路径无效。