案例:演示<jsp:include>动作元素

一、在WebContent下创建两个页面dynamicInclude.jsp和included.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>dynamicInclude page</title>
</head>
<body>
	dynamicInclude.jsp内的中文
	<br>
	<jsp:include page="included.jsp" flush="true" />


</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>include</title>
</head>
<body>
 	<%Thread.sleep(5000);%>
 	included.jsp内的中文<br />
</body>
</html>

二、启动访问

http://localhost:8080/chapter06/dynamicInclude.jsp

 三、修改flush属性值为false

四、调试代码理解flush属性

猜你喜欢

转载自blog.csdn.net/daqi1983/article/details/120903375