AJAX problem with servlet to send data to XMLHttpRequest as responseXML responseText
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   saptarshi_das
Posted On:   Wednesday, December 28, 2005 08:46 AM

How Ajax decides, which response it will set to responseXML and which to responseText. private void writeResponse(HttpServletResponse resp, String output) throws IOException { resp.setContentType("text/xml"); resp.setHeader("Cache-Control", "no-cache"); //resp.getWriter().write(output); PrintWriter out = resp.getWriter(); out.write(output); //out.println(output); //out.flush(); } if I use the above function in my servlet, I don't get the responseText, but if I use the following function I get responseText. private void writeResponse(HttpServletResponse resp, String output) throws IOException { resp.setContentType("t   More>>
			
How Ajax decides, which response it will set to responseXML and which to responseText.

private void writeResponse(HttpServletResponse resp, String output) throws IOException {
resp.setContentType("text/xml");
resp.setHeader("Cache-Control", "no-cache");
//resp.getWriter().write(output);
PrintWriter out = resp.getWriter();
out.write(output);
//out.println(output);
//out.flush();
}

if I use the above function in my servlet, I don't get the responseText, but if I use the following function I get responseText.

private void writeResponse(HttpServletResponse resp, String output) throws IOException {
resp.setContentType("text/xml");
resp.setHeader("Cache-Control", "no-cache");
//resp.getWriter().write(output);
PrintWriter out = resp.getWriter();
//out.write(output);
out.println(output);
out.flush();
}

Please clarify.
   <<Less

Re: AJAX problem with servlet to send data to XMLHttpRequest as responseXML responseText

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, December 30, 2005 03:28 PM

sounds like you need the out.flush() -- does it work with just the out.flush and not the out.println?
About | Sitemap | Contact