请同学们先浏览PPT,这是一个任务点哈!完成后有惊喜哟!

动作元素主要在请求处理阶段起作用,能够影响输出流和对象的创建、使用修改等,如动态地插入文件、调用JavaBean、页面重定向等,它按照XML语法进行书写。
格式:<prefix:tagName [attribute1=value1]…[attributen=valuen]/ >
或者:<prefix:tagName [attribute1=value1]…[attributen=valuen] >
tagbody
</prefix:tagName>

1. <jsp:include>动作
<jsp:include>动作可以在当前的JSP页面中动态加入(包含)静态和动态的资源(如txt文件、JSP文件、HTML文件、Servlet文件等)。如果是静态网页,内容将直接加入到当前JSP网页中;如果是动态网页,会编译运行后再加入到当前JSP网页中。
语法格式:
<jsp:include page="URL或<%=expression%>" flush="true|false"/>
或者:
<jsp:include page="URL或<%=expression%>" flush="true|false">
{<jsp:param name="parameterName" value="parameterValue"/>}*
</jsp:include>
【案例2-7】页面中引入表格
table.jsp页面:
<%
String color = request.getParameter("color");
String title = request.getParameter("title");
String content = request.getParameter("content");
%>
<table border="1" width="50%">
<tr bgcolor="<%=color%>">
<td><%=title%></td>
</tr>
<tr>
<td><%=content%></td>
</tr>
</table>
include.jsp页面:
<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
<title>include动作的使用</title>
</head>
<body>
<h1>include动作的使用</h1>
<jsp:include page="table.jsp">
<jsp:param name="color" value="#00FF00" />
<jsp:param name="title" value="This is the title" />
<jsp:param name="content" value="This is the content" />
</jsp:include>
</body>
</html>
2. <jsp:forward>动作
<jsp:forward>动作标识用来将请求转发到另外一个JSP、HTML或相关的资源文件中。当该标识被执行后,当前的页面将不再被执行,而是去执行该标识指定的目标页面。
语法格式:
<jsp:forward page=”重定向的页面”>
或者:
<jsp:forward page=”重定向的页面">
{<jsp:param name="name" value="value"/>}*
</jsp:forward>
【案例2-8】页面跳转
now.jsp页面:
<%@ page contentType="text/html;charset=UTF-8"%>
跳转之前的内容
<script type="text/javascript">
alert("跳转前");
</script>
<jsp:forward page="next.jsp"/>
跳转之后的内容
<script type="text/javascript">
alert("跳转后");
</script>
next.jsp页面:
<%@ page contentType="text/html;charset=UTF-8"%>
这里是跳转之后的next.jsp
3. <jsp:param>动作
jsp:param:用来提供key/value的信息,可以与<jsp:include>、<jsp:forward>、<jsp:plugin>一起搭配使用。
例如:
<h1>include动作的使用</h1>
<jsp:include page="table.jsp">
<jsp:param name="color" value="#00FF00" />
<jsp:param name="title" value="This is the title" />
<jsp:param name="content" value="This is the content" />
</jsp:include>

