1. First introduce the difference between the write () and print () methods:
(1), write (): Supports output character type data only, character, character array, string, etc.
(2), print (): The data of various types (including object) can be converted into bytes byte form by default encoding, which is output by the write (int c) method
2, introduce the difference between response.getwriter () and out:
(1), out and Response.getwriter classes are not the same, one is JspWriter, the other is java.io.PrintWriter.
(2), the principle of implementation is different: JspWriter is equivalent to a printwriter with a cache function, it does not directly output data to the page, but the data is flushed to the response buffer and then output,
Response.getwriter Direct output data (Response.print ()), so (Out.print) can only be output thereafter.
(3), out for the JSP built-in objects, refresh the JSP page, automatic initialization to get out the object, so the use of the Out object is needed to refresh the page,
The Response.getwriter () response information is output to a Web page through an Out object, and it is automatically closed when the response ends, regardless of the JSP page, without having to refresh the page
Image metaphor: When we call Response.getwriter () This object also obtains the brush of the Web page, then you can use this brush to draw anything you want to display on the Web page.
(4), the Out print () method, and the println () method generate IOException when the buffer overflows and there is no automatic refresh.
Both print and println of the Response.getwrite () method suppress IOException anomalies, and there is no IOException
Out.println (""); Method and page layout can not be wrapped, can only lead the HTML code wrapping, to achieve page layout wrap: Out.println ("</br>");
Response.getwriter (). Write () differs from Out.print ()