jsp中的out与response的输出区别
1.response缓冲区的输出优先于out缓冲区中的数据输出
2.使用out.flush操作将out缓冲区中的输出数据添加到response缓冲区中,随后按照response缓冲区中的顺序输出
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>测试页面</title>
</head>
<body>
<%
out.write("out输出序列1");
out.flush();
out.write("out输出序列2");
response.getWriter().write("response输出序列1");
response.getWriter().write("response输出序列2");
%>
</body>
</html>
输出结果:
out输出序列1
response输出序列1
response输出序列2
out输出序列2
由于jsp翻译之后底层都是用out来进行输出,我们在jsp页面中统一使用out.print()来进行输出
来源:oschina
链接:https://my.oschina.net/u/4238564/blog/4889385