<%@ 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>
<c:forEach var="i" begin="1" end="5" step="1">
<c:if test="${i%2==0}">
<font size="${i}">야호</font></br>
</c:if>
</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>
<c:set var="a" value="11"/>
<c:if test="${a%2==0}">
짝수입니다.
</c:if>
<c:if test="${a%2!=0}">
홀수입니다.
</c:if>
<br/>
<c:choose>
<c:when test="${a%2==0}">
짝수입니다.
</c:when>
<c:when test="${a%2!=0}">
홀수입니다.
</c:when>
<c:otherwise>
?
</c:otherwise>
</c:choose>
</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" %>
<%
// Controller에서 Data를 만들고 JSP로 forward를 하는 경우 가정
String[] str ={"사과","오렌지","포도","바나나","귤"};
request.setAttribute("str", str);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<c:forEach var="f" items="${str}">
${f}</br>
</c:forEach>
</body>
</html>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
// Controller에서 Data를 만들고 JSP로 forward를 하는 경우 가정
List<String> list = new ArrayList<String>();
list.add("사과");
list.add("오렌지");
list.add("포도");
list.add("바나나");
list.add("귤");
request.setAttribute("list", list);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<c:forEach var="f" items="${list}">
${f}</br>
</c:forEach>
</body>
</html>
<%@page import="kr.board.domain.Board"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
// Controller에서 Data를 만들고 JSP로 forward를 하는 경우 가정
List<Board> list = new ArrayList<Board>();
Board vo = new Board();
vo.setIdx(1);
vo.setTitle("TEST");
vo.setWriter("관리자");
vo.setIndate("2022-05-25");
vo.setCount(0);
list.add(vo);
list.add(vo);
list.add(vo);
request.setAttribute("list", list);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
${list[0].idx}<br/>
${list[1].idx}<br/>
${list[1].idx}<br/>
<c:forEach var="vo" items="${list}">
${vo.idx},${vo.title},${vo.writer},${vo.indate},${vo.count} <br/>
</c:forEach>
</body>
</html>