response.getWriter (). The difference between write () and out.print ()

2023-01-16   ES  

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

(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>”);



Random Posts

About Android-Ultra-Pull-TO-Refresh refresh and pull up and load more LXN

The simplest inner network penetration tutorial

How to install VMWARETOOLS tool Dyremember under CentOS

89 -year -old Nobel winner Roger Pairos, there is a fascinating family

leetcode 95. Unique Binary Search Trees II binary search tree 2 solution report