Home > Web Front-end > JS Tutorial > body text

About the output stream at the end of servlet in Ajax technology

亚连
Release: 2018-05-23 15:25:47
Original
1393 people have browsed it

This article mainly introduces the relevant information about the output stream at the end of the servlet in Ajax technology. It is very good and has reference value. Friends in need can refer to it

The server side of Ajax uses PrintWriter out= When resp.getWriter() responds to data, out.print(0) and out.print(1) are used to indicate success or failure, and there is a reason why out.write is not used. First, let’s take a look at the differences between print and write. Similarities and differences.

The common point is: both do not refresh the page, but only write data on the original page. In the end, they both rewrite the write method in the abstract class Writer.

The difference is: the print method Various types of data can be converted into strings for output. The overloaded write method can only output characters, character arrays, strings and other character-related data.

So it is not difficult to find the difference between the two above. In the setting callback function in the js code of the page, the value returned from the server is used to determine what to display. If the last value in the server-side servlet If the output is a number, and using writ, the number will not be converted into a string and output, which will lead to an incorrect judgment of the return value on the page.

The above is the output stream at the end of the servlet in Ajax technology introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for your support of the Script House website!

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Ajax realizes three-level cascading of provinces and municipalities

##Simple application based on Ajax form submission and background processing

Ajax simple implementation of uploading pictures and previewing

The above is the detailed content of About the output stream at the end of servlet in Ajax technology. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!