Today, I wrote a bunch of JSP code, thinking that using out.println () will implement line wrapping, but the result is not wrapped.
Look at the code first:
<%--使用out.print("Hello JSP");方式输出 --%> <% for(int i=0;i<10;i++){ out.println("Hello JSP"); } %>
The output is this:
Baidu found the reason. As follows:
Because the wrapping of HTML is
, Out.println is the equivalent of writing HTML code on the page, HTML code wrapping does not cause the page to display the line, but also in the code to wrap the line after adding
.
So your program has to be written like this:
<%--使用out.print("Hello JSP");方式输出 --%> <% for(int i=0;i<10;i++){ out.println("Hello JSP<br>"); } %>
The results are as follows:
Knowledge Point Supplement:
Represents a horizontal line.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
OUT.PRINTLN () Why not wrap in JSP