<c:remove>标签
JSTL <c:remove> 标签用来删除某个范围内的值。
页面输出结果为:
语法
JSP <c:remove> 标签语法如下:<c:remove var="varname" [scope="page|request|session|application]其中:
- varname:指要删除的某对象或某参数
- scope:要删除的作用域,默认为 page
示例
下面为 <c:remove> 标签的简单实例。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<title>编程帮(www.biancheng.net)</title>
</head>
<body>
<body>
<c:set var="num" scope="session" value="${4*4}" />
<p>
删除前的值为:
<c:out value="${num}" default="null" />
</p>
<c:remove var="num" />
<p>
删除后的值为:
<c:out value="${num}" default="null" />
</p>
</body>
</html>
页面输出结果为:
删除前的值为: 16
删除后的值为: null
ICP备案:
公安联网备案: