OUT.PRINTLN () output to the client.
In Out.println (), out is an instance of response, which is output by response as an object, outputting content to the client. If you use SYSTEM.OUT.PRINTLN () in a JSP page, only one space is printed on the client.
System.out.println () is printed in the console.
System.out.println () is the standard output stream, which is output on the console, and the JSP is not a console program. Both in JSP and in Java programs, SYSTEM.OUT.PRINTLN () is printed on the console. If you want to print on a page, the easiest way to do this is to:
Out.print ("Content to be printed");
In fact, in the formal construction of the website, is never out.println (), are directly using the label.
Example:
Server platform: Tomcat.
Client: Firefox browser.
Source program:
//test.jsp file
<% @page contenttype= "text/html;charset=gb2312"%>
<body
<%@ page import = "Java.util.Date"%>
<%
Out.println ("This was printed by OUT.PRINTLN." );
System.out.println ("This is printed by System.out.println.");
System.out.println ("This is printed by System.out.println.");
System.out.println ("This is printed by System.out.println.");
Out.println ("This is printed by out.println."); Results in
%>
</body>
Client (browser):
There is a space between the contents of the two out.println () output from the above figure (although the source program calls 3 times System.out.println). Results from the
Console:
from the image above, you can see the contents of the call 3 times System.out.println () (The rest is server information).