语法:
<c:remove var="varName" [scope="{ page|request|session|application }"] />
<c:remove>标签用于删除数据,它有如下属性:
名 称
说 明
EL
类型
必须
默认值
var
欲移除的变量名称
N
String
是
无
scope
var变量的JSP范围
N
String
否
page
scope范围,包括page、request、session、application等;
例:
<c:remove var="test2" scope="session"/>
从session中删除test2变量。
教材例程15-4,c_remove.jsp,<c:remove>标签的应用。
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL:c:remove的使用</title>
</head>
<body bgcolor="#FFFFFF">
<c:set value="10000" var="maxUser" scope="application"/>
<c:set value="20" var="maxIdelTime" scope="session"/>
<c:set value="hellking" var="accountId" scope="request"/>
<c:set value="next.jsp" var="nextPage" scope="page"/>
在没有调用c:rmeove之前,有这些参数:
maxUser=<c:out value="${maxUser}"/>,
maxIdelTime=<c:out value="${maxIdelTime}"/>,
accountId=<c:out value="${accountId}"/>,
nextPage=<c:out value="${nextPage}"/>。
<hr>调用c:remove...
<c:remove var="maxUser" scope="application"/>
<c:remove var="maxIdelTime" scope="session"/>
<c:remove var="accountId" scope="request"/>
<c:remove var="nextPage" scope="page"/>
调用了c:remove后,这些参数值为:
maxUser=<c:out value="${maxUser}"/>,
maxIdelTime=<c:out value="${maxIdelTime}"/>,
accountId=<c:out value="${accountId}"/>,
nextPage=<c:out value="${nextPage}"/>,
</body>
</html>