English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The <c:remove> tag is used to remove a variable, and the scope of the variable can be specified. If not specified, it defaults to the scope where the variable first appears.
This tag is not particularly useful, but it can be used to ensure that JSP completes the cleanup work.
<c:remove var="<string>" scope="<string>"/>
The <c:remove> tag has the following attributes:
Attribute | Description | Whether Necessary | Default Value |
---|---|---|---|
var | Variable Name to Remove | Yes | None |
scope | Scope of the Variable | No | All Scopes |
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>c:remove Tag Example</title> </head> <body> <c:set var="salary" scope="session" value="${2000*2">/> <p>The value of 'salary' variable: <c:out value="${salary}"/></p> <c:remove var="salary"/> <p>The value after deleting the 'salary' variable: <c:out value="${salary}"/></p> </body> </html>
The running result is as follows:
The value of 'salary' variable: 4000 The value after deleting the 'salary' variable: