|
|
Set & Remove in JSP Core Tag Library
|
Tutorials

Jsp

|
Topic |
What is "set", "remove" tag in JSP Core Tag Library?
|
|
Explanation |
|
The set and remove tags are used to set and remove values for JSP EL variables or its property with
the following scopes like page, request, session or application scope.
Syntax:
<c:remove var="var" [scope="page|request
|session|application"] />
Example:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<c:set var="i" value="${1}"/>
<c:set var="s" value="${2}"/>
<c:set var="j" value="${s+i}"/>
<p>Example of Core tag with "set"</p>
<c:out value="Sum = ${j}"/><br/>
Result:
Example of Core tag with "set"
Sum = 3
In the above example first the values for the variable "i", "s" are defined and the value of "j" is
is set using an expression "{s+i}" all using the "<c:set" tag.
The "remove" tag can be used to remove an Expression Language Variable like below.
Example:
<c:remove var="i" scope="session"/>
|
|
A Note |
|
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.
|
|
|
|