Notice
Recent Posts
Recent Comments
Link
«   2024/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
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter05 : JSTL1 /JSTL2 본문

JSP/JSTL

chapter05 : JSTL1 /JSTL2

GAWON 2023. 5. 24. 18:40
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>     
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>일반 for문 형식의 forEach</h1>
	<c:forEach var="i" begin="1" end="10" step="1">
		${i }<br>
	</c:forEach>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>향상 for문 형식의 forEach</h1>
	<%
		String[] names = {"김", "이", "박", "최", "정"};
		pageContext.setAttribute("NAMES", names);
	%>
	<c:forEach var="name" items="${NAMES }">
		${name }<br>
	</c:forEach>
</body>
</html>

'JSP > JSTL' 카테고리의 다른 글

chapter07 : JSTL  (0) 2023.05.24
chapter06 : JSTL1 / JSTL2  (0) 2023.05.24
chapter04 : JSTL1 / JSTL2  (0) 2023.05.24
chapter03 : JSTL1 / JSTL2  (0) 2023.05.24
chapter02 : JSTL1 / JSTL2  (0) 2023.05.24