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!