function startRequest() {
createXMLHttpRequest();
var url = "Test01"
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", url, true); xmlHttp.send(null);
}
function handleStateChange() { if(xmlHttp.readyState == 4) {
alert(xmlHttp.status );
if(xmlHttp.status == 200) {
alert("The server replied with: " + xmlHttp.responseText);
}
}
}Test01是个java类,就打印一句话,我吧url的路径设为同目录下的xml文件 是正常的 ,访问后台就404,路径我改了好几次了什么../../../Test01还是404,请大家指点下问题出在哪里了
createXMLHttpRequest();
var url = "Test01"
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", url, true); xmlHttp.send(null);
}
function handleStateChange() { if(xmlHttp.readyState == 4) {
alert(xmlHttp.status );
if(xmlHttp.status == 200) {
alert("The server replied with: " + xmlHttp.responseText);
}
}
}Test01是个java类,就打印一句话,我吧url的路径设为同目录下的xml文件 是正常的 ,访问后台就404,路径我改了好几次了什么../../../Test01还是404,请大家指点下问题出在哪里了
—— 这是不可能直接访问到的。
要么你得把Test01写成Servlet,并映射到某个 URL 上。
要么你把Test01改成JSP页面,然后直接请求这个JSP页面。
建议你刚开始玩,先用JSP弄通原理吧:
var url = "\xxoo\test01.jsp";
普通类没办法请求