out.println()在JSP中不能换行了?

来源:3-5 JSP注释

慕后端1209861

2018-09-26 21:17:50

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	out.println("hello world1");
	//out.print("<br>");
	out.println("hello world2");
	//out.print("<br>");
	out.println("hello world3");
%>
</body>
</html>

http://img.mukewang.com/climg/5bab86ea0001c6a308080258.jpg

写回答

1回答

chrismorgen

2018-09-27

是的,因为在html页面中<br>才是换行,所以out.println不能换行,只是可以输出内容,不过你可以在输出内容中加入<br>标签,譬如:out.println("hello world1<br>");,这样就可以达到换行的效果,如果我的建议解决了你的问题,请采纳,祝学习愉快~

0

0 学习 · 10204 问题

查看课程