About the output stream at the end of the servlet in Ajax technology, ajax output stream
The Ajax server uses PrintWriter out = resp. when getWriter () is used to respond to data. print (0), out. print (1) indicates success or failure, instead of out. there is a reason for writing. First, let's take a look at the similarities and differences between print and write.
In common: both of them do not flat New pages, but only write data on the original pages. In the end, they all overwrite the write method in the abstract class Writer.
The difference is that the print method can convert various types of data into strings for output. The reload write method can only output character-related data, such as characters, character arrays, and strings.
Therefore, from the difference between the two above, it is not difficult to find that in the setting callback function in the js Code on the page, it is determined by the value returned by the server, if the number is output at the end of the servlet on the server, and writ is used, the number will not be converted into a string for output, resulting in incorrect judgment on the returned value on the page.
The above is the output stream at the end of servlet in the Ajax technology introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!