JSTL - Core <c:remove> Tag


Advertisements

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 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 the following attributes −

Attribute Description Required Default
var Name of the variable to remove Yes None
scope Scope of the variable to remove No All scopes

Example

<%@ 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>Before Remove Value: <c:out value = "${salary}"/></p>
         <c:remove var = "salary"/>
      <p>After Remove Value: <c:out value = "${salary}"/></p>
   </body>
</html>

The above code will generate the following result −

Before Remove Value: 4000
After Remove Value: 
jsp_standard_tag_library.htm

Useful Video Courses


Video

JSP, Servlet, JSLT + Hibernate: A complete guide

108 Lectures 11 hours

Chaand Sheikh

Video

Full Stack Java developer - Java + JSP + Restful WS + Spring

Best Seller

517 Lectures 57 hours

Chaand Sheikh

Video

Servlets and JSP Tutorial For Beginners!

41 Lectures 4.5 hours

Karthikeya T

Video

JSP and Servlets - The Complete Course

42 Lectures 5.5 hours

TELCOMA Global

Video

JSP and Servlets Bootcamp: Web Applications for Beginners

15 Lectures 3 hours

TELCOMA Global

Video

JSP (Java Server Pages) Certification Training

44 Lectures 15 hours

Uplatz

Advertisements