1. First introduce the difference between the WRITE () and Print () methods:
(1), WRITE (): Only support output character type data, characters, character array, string, etc.
(2), Print (): You can convert various types of data (including Object) data by default to Bytes bytes. These bytes are output through WRITE (int C) method.
2, introduce the difference between response.getWriter () and out:
(1), out, and response.getWriter are different, one is jspwriter, and the other is java.io.printwriter.
(2) Different execution principles: JSPWRITER is equivalent to a PrintWriter with cache function. Response.print ()), so (out.print) can only be output afterwards.
(3), out is the built -in object of JSP, refresh the JSP page, and automatically initialize to obtain the OUT object, so the OUT object needs to refresh the page. The response.getWriter () response information is output to the web page through the OUT object. When the response is over, it is automatically closed, which has nothing to do with the JSP page. There is no need to refresh the page. At this time, you can draw anything you want to show on the webpage through this brush.
(4), out of the print () method and the println () method when the buffer overflows and does not automatically refresh it.
and the Print and Println of the Response.getWrite () method are both IOEXCEPTION, and there will be no IOEXception Out.println (“”). The page layout can be replaced: out.println (“</br>”);
Reprinted: https://www.cnblogs.com/oldzhao/p/4989983.html