JavaServer Pages Standard Tag Library
참조: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
총 다섯 종류의 표준 태그 라이브러리 제공.
# Core: http://java.sun.com/jsp/jstl/core
# XML: http://java.sun.com/jsp/jstl/xml
# Internationalization: http://java.sun.com/jsp/jstl/fmt
# SQL: http://java.sun.com/jsp/jstl/sql
# Functions: http://java.sun.com/jsp/jstl/functions
Core 태그는 다시 네 가지로 나뉨.
Variable support (remove,set)
Flow control (choose, when, otherwise, forEach, forTokens, if)
URL management (import, param, redirect, param, url, param)
Miscellaneous (catch, out )
변수 만들기
<c:set var="변수명" value="값" scopr="application|session|request|page" />
변수 지우기
<c:remove var="변수명" />
조건문
if문
<c:if test="${!empty param.Add}">
<c:set var="bid" value="${param.Add}"/>
<jsp:useBean id="bid" type="java.lang.String" />
<sql:query var="books"
dataSource="${applicationScope.bookDS}">
select * from PUBLIC.books where id = ?
<sql:param value="${bid}" />
</sql:query>
<c:forEach var="bookRow" begin="0" items="${books.rows}">
<jsp:useBean id="bookRow" type="java.util.Map" />
<jsp:useBean id="addedBook"
class="database.BookDetails" scope="page" />
...
<% cart.add(bid, addedBook); %>
...
</c:if>
switch-case와 비스무리한 것
<c:choose>
<c:when test="${customer.category == 'trial'}" >
...
</c:when>
<c:when test="${customer.category == 'member'}" >
...
</c:when>
<c:when test="${customer.category == 'preferred'}" >
...
</c:when>
<c:otherwise>
...
</c:otherwise>
</c:choose>
반복문
<c:forEach var="item" items="${sessionScope.cart.items}">
...
<tr>
<td align="right" bgcolor="#ffffff">
${item.quantity}
</td>
...
</c:forEach>
URL 태그, Miscellaneous 태그는 PASS