<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%-- 스크립틀릿 태그에 지역변수 사용하기 --%>
<%
int a = 2;
int b = 3;
int sum = a + b;
out.println("2 + 3 = " + sum);
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%-- 스크립틀릿 태그에 0부터 10까지의 짝수 출력하기 --%>
<%
for (int i = 1; i <= 10; i++) {
if (i % 2 == 0) {
out.println(i + "<br>");
}
}
%>
</body>
</html>