JSTL Core set Tag


JSTL Core set Tag

JSTL Core set Tag is use to set or define some value in jsp page , It is similar to jsp:setProperty action tag in JSP and similar to String name = “Vikash” in java.

Syntax

<c:set var="name" scope="request" value="Vikash Kumar" />

Here name is variable name and value is Vikash Kumar and in scope you can set either application or request or session based on your requirement.

Example

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
 pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSTL Examples</title>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
</head>
<body>
 <c:set var="name" scope="request" value="Vikash Kumar" />
 <c:out value="${name}" />
</body>
</html>

Output

Vikash Kumar

 

 






Full-stack web and mobile app development company Contact Us : Skype: indore.webcoder Email: info@w3sparks.com Sales: +91 8085506229