Response.getwriter (). Append (string content)---output a string to a page
The type of the Out object is JspWriter, and Response.getwriter () is a printwriter, and the Out object can also be obtained by Pagecontext.getout (), and the two objects are of different types
Out.print (null); Throws an exception, printwriter.print (NULL) does not throw an exception
JspWriter is an abstract class, and PrintWriter is an ordinary class that inherits writer.
The Getwriter () method can output a string of characters on the page, and out is also an output object, the difference being that the result of the Getwriter () method, always takes precedence over the Out object, can use the Out.flush () method to force the contents of the property buffer, Outputs the output of an Out object first
Causes of this phenomenon:
The Out object is actually dependent on the printwriter, he needs to save the output to the response buffer, and then wait for the JSP page out to meet certain conditions before the output method will be called to output the content directly to the page
And printwriter can be directly output.
The difference between response.getwriter () and out objects in a JSP