Latest web development tutorials

<C: remove> tag

JSP Standard Tag Library JSP Standard Tag Library

<C: remove> tag is used to remove a variable, you can specify the variable scope, if not specified, the default is the first time the scope of the variable.

This tag is not particularly useful, but can be used to ensure that JSP complete cleanup.

Syntax

<c:remove var="<string>" scope="<string>"/>

Attributes

<C: remove> tag has the following attributes:

Attributes description If necessary Defaults
var To remove the variable name Yes no
scope Scope of the variable belongs no All scopes

Examples Demo

<%@ 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 标签实例</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<p>salary 变量值: <c:out value="${salary}"/></p>
<c:remove var="salary"/>
<p>删除 salary 变量后的值: <c:out value="${salary}"/></p>
</body>
</html>

Results are as follows:

salary 变量值: 4000

删除 salary 变量后的值:

JSP Standard Tag Library JSP Standard Tag Library