jsp动作元素主要包括7个:
<jsp:include>
<jsp:forward>
<jsp:param>
<jsp:plugin>
<jsp:useBean>
<jsp:setProperty>
<jsp:getProperty>
<jsp:include>动作元素:
提供了在jsp中包含页面的方式,包括静态文件和动态文件。
<jsp:include>的语法格式:
<jsp:include page="relative URL" flush="true|false" />
<jsp:include>中的两个属性:
page属性:指定被包含的URL地址。
flush属性:指定当缓冲区满时,是否将其清空。默认值为false
例子:
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JSP include test</title>
</head>
<body>
<jsp:include page="hello.txt"></jsp:include>
<jsp:include page="hello.jsp"></jsp:include>
<jsp:include page="1.html"></jsp:include>
</body>
</html>
运行时会将hello.txt文件中的内容显示出来,并执行hello.jsp文件
本文介绍了JSP中的7个主要动作元素,重点讲解了<jsp:include>元素的使用方法及其属性page和flush的作用。通过示例展示了如何包含不同类型的文件。
893

被折叠的 条评论
为什么被折叠?



