Ajax壮态码返回400

var xmlrequest; function createXMLHttpRequest() { if(window.XMLHttpRequest){ xmlrequest = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlrequest = new ActiveXObject("Microsoft.XMLHTTP"); } } function change(id) { createXMLHttpRequest(); var uri = "/ajax"; //Servlet xmlrequest.open("POST", uri, true); xmlrequest.onreadystatechange = processResponse; xmlrequest.send("id="+id); } function processResponse() { if(xmlrequest.readyState == 4) { alert(xmlrequest.status); //返回400 if(xmlrequest.status == 200) { var cityList = xmlrequest.responseText.split(","); var displaySelect = document.getElementById("second"); for(i = displaySelect.length - 1; i >= 0; i--) { displaySelect.options[i] = null; } for (var i = 0 ; i < cityList.length ; i++) { option = document.createElement("option"); txtNode = document.createTextNode(cityList[i]); option.appendChild(txtNode); displaySelect.appendChild(option); } } } }

请大家指点一下
web.xml


Ajax
com.ou.util.Ajax


Ajax
/ajax

http 400 = Bad Request

建议手动在浏览器中输入 ajax所请求的地址 查看返回结果

很有可能是相对路径导致的错误

ajax 请求了 http://yourhost/ajax
但实际路径可能是 http://yourhost/yourcontext/ajax