JSTL Core Tag c:remove Example
- Details
- Written by Nam Ha Minh
- Last Updated on 31 August 2019   |   Print Email
JSTL <c:remove> Syntax:
<c:remove var="<string>" scope="<string>"/>Attributes:
Name | Required | Type | Description |
var | True | java.lang.String | Name of the scoped variable to remove from scope. |
scope | False | java.lang.String | Scope where the variable can be found. (Optional) |
JSTL <c:remove> Example:
The below example a variable into session scope and prints its value before and after removing it from the session scope.<c:set var="userName" scope="session" value="Code Java"/> <p>Before removing value from session: <c:out value="${userName}"/></p> <c:remove var="userName"/> <p>After removing value from session: <c:out value="${userName}"/></p>
Output:
Recommended Usage of JSTL <c:remove> tag:
This tag may be useful in cases where JSP can clean up any scoped variable it has set.
Other JSTL Core Tags:
if | catch | choose | forEach | forTokens | import | out | param | redirect | set | url
Comments