[선언]
<%@ taglib prefix="c" uri="http;//java.sun.com/jstl/core" %>
[액션]
EL 지원 :: catch, out, remove, set
흐름제어 :: choose(when, otherwise), forEach, fotTokens, if
URL관리 :: import(param), redirect(param), url(param)
Core 객체
1) escapeXml 기본값으로 true를 지니며 true일 때 value 값의 html 태그
문자열로 그대로 반환한다.
2)액션의 속성 이름(var) 이름이 같을 때 가까운 이름의 값을 출력
하지만 scope 가 같으면 같은 이름을 허용하지 않는다.
3)JSP 는에서는 ${} 값은 자동처리한다.
<%@ page contentType="text/html;charset=euc-kr"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<h2>CORE 객체</h2>
<hr>
<pre>
1+2 // {1+2} // ${1+2} :: <c:out value="${1+2}" />
${1 gt 3} :: <c:out value="${1 gt 3}" />
<c:out value="${'${'}test}" />
<!--escapeXml="true" 기본값이다. true일때는 html이 먹히질 않는다.-->
<c:out value="<font color='skyblue'>안녕하세요</font>" />
<c:out value="<font color='skyblue'>안녕하세요</font>" escapeXml="false" />
<hr>
<h2>SET</h2>
<hr>
<c:set var="name" value="하늘" scope="session" />
Set으로 Session의 name <br>
c:out : <c:out value="${name}" /><br>
Session : <%= session.getAttribute("name") %><br>
======================================
<c:set var="name">파랑파랑</c:set>
Set으로 page의 name
c:out1: <c:out value="${name}" /><br>
PageScope: <c:out value="${pageScope.name}" /><br>
SessionScope: <c:out value="${sessionScope.name}" /><br>
Session : <%= session.getAttribute("name") %><br>
<hr>
<h2>Remove</h2>
<hr>
remove<c:remove var="name" scope="session" /><br>
Session : <%= session.getAttribute("name") %><br>
<!-- pageScope 의 name 삭제 하지 않았기에 값이 그대로 존재-->
PageScope: <c:out value="${pageScope.name}" /><br>
SessionScope: <c:out value="${sessionScope.name}" /><br>
<hr>
<h2>Catch</h2>
<hr>
<c:catch var="errmsg">
line1
<%= 1/0 %>
line2
</c:catch>
<c:out value="${errmsg}" />
</pre>




덧글