English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tag <c:remove>

Bibliothèque de balises standard JSP

The <c:remove> tag is used to remove a variable, which can specify the scope of the variable. If not specified, the default scope is 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.

Format grammatical

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

Attribut

Les balises <c:remove> ont les attributs suivants:

AttributDescriptionNécessaire?Valeur par défaut
var Nom de la variable à supprimer Oui Aucun
scope Scope de la variable Non Tous les scopes

Exemple de démonstration

<%@ 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>Exemple de balise c:remove</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2">/>
<p>Valeur de la variable salary: <c:out value="${salary}"/></p>
<c:remove var="salary"/>
<p>Valeur après suppression de la variable salary: <c:out value="${salary}"/></p>
</body>
</html>

Résultat de l'exécution suivant:

Valeur de la variable salary: 4000
Valeur après suppression de la variable salary:

Bibliothèque de balises standard JSP