JSTL cset Core Tag

The JSTL <c:set> Core Tag is used to set a value to a variable or object in a specific scope like a session. It works like setProperty action but the difference is that it can take an expression as an input, evaluate it, and assign the result to a variable or object.



<c:set var="varName" value="value/expression" />


c:set tag attributes:

Attribute Description Required
value Information to save. No
target Name of the variable whose property should be modified. No
property Property to modify. No
var Name of the variable to store information. No
scope Scope of variable to store information. No




<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
        <title>c:set JSTL core tag example</title>
        <c:set var="website" value="826.a00.myftpupload.com"/>
        <c:out value="${website}"/>