티스토리 뷰

카테고리 없음

0106_2 JSTL

이브마드 2020. 1. 6. 19:41

JSTL

- 개념  :  액션태그는 JSP에서 프로그래머가 직접 필요한 태그를 만들어 사용할  있는 커스텀 태그(Custum  tag) 

JSTL 필요한 기능들을 모아놓은 커스텀 태그

         : 활용 빈도가 높은 태그를 개발, 발표한 것이 자바 표준 라이브러리(JSTL : 표준 커스텀 태그)

- 종류 : Core/ XML/ Internationalizaion/ Database/ Functions_  Core 사용함(변수지원/ 제어흐름/ URL관리/ 출력, 예외처리)

       : 접두어(Prerix) = ‘c’ uri = ‘http://java.sun.com/jsp/jstl/core

- 사용을 위한 라이브러리 주소 : http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<!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=EUC-KR">
        <title>0106오후 1 JSTL첫 예제</title>
    </head>
    <body>
        
        <c:out value="Hello JSTL!!!!!!!!"></c:out>
        <!--  custom tag는 "out" : 틀려선 안되는 부분 uri / 커스텀태그 / 접두어는 틀려도 동작은 하지만 세계적인 약속이기때문에 틀리지말것 -->
        <!--  쿼크스 모드 덕에 볼 수 있당 -->
    
    </body>
</html>
<!--  출력 내용 Hello JSTL!!!!!!!!  -->
 

1.코어 태그 라이브러리 set

속성

필수

기본값

자료유형

기능

var

x

 

String

값이 저장되는 변수 이름

target

x

 

String

 

value

x

 

String

변수 또는 객체에 저장할 

property

x

 

String

target 객체의 property이름

scope

x

page

String

변수가 효력을 발휘하는 영역으로 

page/ request/ session/application하나를 지정

= 이걸 전부 이해해야   있다

 

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
31
32
33
34
35
36
37
38
39
40
41
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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=EUC-KR">
        <title>0106_오후 2_ JSTL:Core set</title>
    </head>
    <body>
        <h2> JSTL Core Tag : set</h2>
        <c:set var="foo" value="set Tag 테스트임당"/>
        \${foo} = ${foo}<br>
        <c:set var = "n">
        24
        </c:set>
        \${n} = ${n} <br>
        <c:set var="d">
        31.54
        </c:set>
        \${d} = ${d} <br>
        \${n+d} = ${n+d}<br>
        <c:set var="b" value="true">
        </c:set>
        \${!b } = ${!b }<br>
        <c:set var="str" value="~~~~=Hello set Tag~~~~" scope="session"/>
        \${str} = ${str}<br>
        \${sessionScope.str} = ${sessionScope.str<br>
    </body>
</html>
 
<!-- 
JSTL Core Tag : set
${foo} = set Tag 테스트임당
${n} = 24
${d} = 31.54
${n+d} = 55.54
${!b } = false
${str} = ~~~~=Hello set Tag~~~~
${sessionScope.str} = ~~~~=Hello set Tag~~~~
 -->
 
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/07   »
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 31
글 보관함