jsp를 이용한 간단하게 사용 할 수 있는 자바태그
<%@ page contentType="text/html; charset=EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
browser변수값 설정
<c:set var="browser" value="java jstl"/><br>
<c:out value="${browser}"/><p>
browser변수값 제거 후
<c:remove var="browser"/>
<c:out value="${browser }"/>
업그레이드
<%@ page contentType="text/html; charset=EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="number" value="<%=new int[]{10,20,30,40,50} %>"/>
<c:forEach var="num" items="${number}"> <!-- 업그레이드 for문 items는 반복 -->
<c:out value="${num}" />
</c:forEach>
for문
<%@ page contentType="text/html; charset=EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:forEach var="num" begin="1" end="10" step="1">
<c:out value="${num}" />
</c:forEach>
begin:시작
end:끝
step:증가값
<%@ page contentType="text/html; charset=EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="number" value="1,2,3,4,5,6,7,8,9" />
<c:forTokens items="num" items="${number }" delims=",">
<!-- delims는 구분자 ,말고 다른것도 가능 -->
${num } <br />
</c:forTokens>
'jsp2.0' 카테고리의 다른 글
2014-10-08 (0) | 2014.10.08 |
---|---|
2014-10-07 (0) | 2014.10.07 |
10-01 슈퍼인터페이스 (0) | 2014.10.01 |
모델2기반의 MVC패턴 (0) | 2014.09.30 |
2014-09-29 표현언어 (0) | 2014.09.29 |