日期:2014-05-17  浏览次数:20700 次

求牛人解决问题
为什么我编写的一个简单的应用(使用ajax技术异步的向服务器发送请求),我在做
xhr.onreadystatechange=function(){
if(xhr.readyState==4){
var txt = xhr.responseText;
alert(txt);
}
};
对服务器返回的数据进行了判断,判断它的状态码,我收到这个文本进行在页面上弹出,确是
<html><head><title>Apache Tomcat/6.0.37 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /ajax01/check_username</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/ajax01/check_username</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.37</h3></body></html>
请问如何解决。。。实在是无语
------解决方案--------------------
你ajax请求的路径不对吧,找不到/ajax01/check_username。
你把你代码贴出来看看。
你在这个servlet里设一个断点,或者system.out.print一下,看看能不能访问。
------解决方案--------------------
HTTP Status 404
------解决方案--------------------
HTTP Status 404 - /ajax01/check_username
The requested resource is not available.

你的请求提交错了路径
------解决方案--------------------
你的ajax请求的资源部存在,返回了404页面的代码!