SYSTEM.OUT.PRINTLN () differs from OUT.PRINTLN () in JSP __jsp

Source: Internet
Author: User
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).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.