Xmlhttpreq. responsexml is empty! Xmlhttpreq. responsetext is not empty!

Source: Internet
Author: User

I am doing a simple example of Ajax asynchronous data return, Ajax + JSP + Struts implementation. when loading the page, I will first call data from the database, when I return the data obtained from the database in the action

Response. setcontenttype ("text/XML ");

Response. setheader ("cache-control", "No-Cache ");

All the statements in the action are successfully executed, but the xmlhttpreq output when the customer is returned. responsexml is null. At first, I suspect that an error is returned from the server. responsetext, which can normally display text content. I have found a lot of solutions on the Internet. later, I took a closer look at the process of the program and thought that the return in the action should not be redirected, because the page is reloaded after the page is redirected, which may lead to an endless loop. I set return to null and finally solved the problem!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.