티스토리 뷰

JSTL

[JSTL] Core :: set tag

A형개발자 2016. 8. 4. 07:58

JSTL Core - set tag

Sets the value of a scoped variable or a property of a target object.

Attributes

Name Dynamic Type
value true Object
var false String
scope false String
target true Object
property true String

How to use

Set a message to request and dispaly the message using out tag.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>JSTL set tag example</title>
</head>
<body>
<c:set var="umejintan" scope="request" value="Hello, UserName"/>
<c:out value="${umejintan}"/>
</body>

Syntax

Syntax 1: Set the value of a scoped variable using attribute value
<c:set value=”value”  var=”varName” [scope=”{page|request|session|application}”]/>


Syntax 2: Set the value of a scoped variable using body content
<c:set var=”varName” [scope=”{page|request|session|application}”]>
body content
</c:set>

Reference

'JSTL' 카테고리의 다른 글

[JSTL] Core :: choose tag  (0) 2016.08.08
[JSTL] Core - if tag  (0) 2016.08.07
[JSTL] Core :: catch tag  (0) 2016.08.07
[JSTL] Core :: remove tag  (0) 2016.08.04
[JSTL] Core :: out tage  (0) 2016.08.04
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함