Common problems in the development of AJAX programs, look at the article may be less you make a lot of mistakes.
Eclipse Debug does not enter an action when the XML document returned by response in 1.ajax,action is malformed.
2.ajax cache problem, you need to add Xmlhttp.setrequestheader ("If-modified-since", "0"), you can solve.
3. If not AJAX submission, and set the printwriter out = Response.getwriter (), then the JSP will produce Chinese garbled.
4.ajax reason to return XML garbled
Response.setcontenttype ("TEXT/XML;CHARSET=GBK");
PrintWriter out = Response.getwriter ();
That's how it works, if it does:
PrintWriter out = Response.getwriter ();
Response.setcontenttype ("TEXT/XML;CHARSET=GBK");
So Response.setcontenttype ("TEXT/XML;CHARSET=GBK"), it does not work so the return is garbled, this problem for a long time, the code has to look carefully ah.
5.ajax form Submission
Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
Because the pass is UTF-8 encoded, the corresponding transcoding is done when accepting in the action or servlet.