JSTL Core tag - remove() : Function

The <c:remove> tag removes a variable from either a specified scope or the first scope where the variable is found (if no scope is specified). This action is not normally particularly helpful, but it can aid in ensuring that a JSP cleans up any scoped resources it is responsible for.

Attribute:

The <c:remove> tag has following attributes:

AttributeDescriptionRequiredDefault
varName of the variable to removeYesNone
scopeScope of the variable to removeNoAll scopes

JSTL Example :

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>JSTL Tag Example</title>
</head>
<body>
<c:set var="num" scope="session" value="${1234}"/>
<p>Before Remove Value : <c:out value="${num}"/></p>
<c:remove var="num"/>
<p>After Remove Value : <c:out value="${num}"/></p>
</body>
</html>

Output :

Before Remove Value : 1234
After Remove Value  :