Posted By:
Sweta_Gupta
Posted On:
Monday, September 10, 2007 10:16 PM
Can any body help me please? The code is as follows: The request is made as follows in javascript function validateLogin() { req = newXMLHttpRequest(); var url = "http://localhost:8090/RealEstateProject/UserLogin"; req.open("GET", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.onreadystatechange = updateMsg; req.send(null); } The updateMsg is as follows: function updateMsg() { if (req.readyState==4 ) { responseFromServlet = req.responseXML; var cart = responseFromServlet.getElementsByTag
More>>
Can any body help me please?
The code is as follows:
The request is made as follows in javascript
function validateLogin() {
req = newXMLHttpRequest();
var url = "http://localhost:8090/RealEstateProject/UserLogin";
req.open("GET", url, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.onreadystatechange = updateMsg;
req.send(null);
}
The updateMsg is as follows:
function updateMsg() {
if (req.readyState==4 ) {
responseFromServlet = req.responseXML;
var cart = responseFromServlet.getElementsByTagName("cart")[0];
//var item = cart.getElementsByTagName("item");//.firstChild.nodeValue;
//var name = item.getElementsByTagName("name")[0].firstChild.nodeValue;
//alert (name);
alert("response Text: "+responseFromServlet);
The variable item is not coming and the error is object does not support this.
The responseFromServlet is coming null.
at the servlet end
response.setContentType("text/xml");
String xmlL = toXml();
System.err.println(xmlL);
response.getWriter().write(xmlL);
The toXML method is:
public String toXml() {
StringBuffer xml = new StringBuffer();
xml.append("
<?xml version="1.0"?>
");
xml.append("
");
xml.append("
");
xml.append("
");
xml.append("Sweta GUPTA");
xml.append("
");
xml.append("
");
xml.append("Papa gupta");
xml.append("
");
xml.append("
");
xml.append("
");
return xml.toString();
}
<<Less