我在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>
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>
httpreq.open("GET","report_distb.do",true)改为
httpreq.open("GET","/你的工程名/report_distb.do",true)看看
httpreq.open("GET","report_distb.do",true)
用post,另外你把路径写成绝对路径
2009-09-09 14:08:48,750 ERROR RequestProcessor:664 - Invalid path /idc/report/report_distb was requested
哈哈!好看我就回答.....有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
是你的report_distb 页面664行有错误吗?
webRoot->idc->res->MyJsp.jsp这就能提交进去.
改为 httpreq.open("GET","<%=head%>report_distb.do",true) ;
改为 httpreq.open("GET"," <%=head%>/report_distb.do",true) ;
少写了个/
2009-09-09 14:55:54,562 ERROR RequestProcessor:664 - Invalid path /report_distb was requested
在<html> 之前添加
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>然后在<head>标签内部添加:
<base href="<%=basePath%>"/>如果再有问题我就怀疑是的web.xml配置有问题了
去下个httpwatch 吧 能看到你提交的到底是什么url.
再把你现在的jsp文件贴我看下
嗯,我去下个,来看看
<%
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>
你覆盖下看看 我就不信还有问题
下个httpwatch自己看路径吧。
result: 404
url: http://localhost:8080/EasyBSC/idc/report/report_distb.do你看看
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})
这样就应该可以了。
明显不对 应该请求到
http://localhost:8080/EasyBSC/report_distb.do
才正确,难道base对ajax提交url不起作用。你用楼上的方式试试看应该有用。
httpreq.open("GET","report_distb.do",true)
改成
httpreq.open("GET","../../report_distb.do",true)
向上跳两层总没问题了把
path="/report_distb" scope="request"
type="EasyBSC.controller.action.res.report.ReportDisplayTbAction">
</action> 感觉这有问题,type有问题,
path="/report_distb" scope="request"
type="EasyBSC.controller.action.res.report.ReportDisplayTbAction">
</action> type="EasyBSC.controller.res.report.action.ReportDisplayTbAction">
你把配置文件再整理一下,感觉挺乱的
就是路径了。
我觉得也是这个。
其实Struts有一个url标签的,用它就不会有这种问题了。
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再联系吧。
http://localhost:8080/EasyBSC/report_distb.do 还是报路径无效。