programing/JSP
JSP - 구구단 출력하기
h-elena
2018. 3. 8. 10:40
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%--
<%! %> 선언문(자바 변수, 메소드 선언)
<% %> 스크릿렛(자바 로직)
<%= %> 식 표현(html에 출력)
<%-- --> 주석
--%>
<%!
StringBuilder sb = new StringBuilder();
%>
<%
for(int i=1; i<=9; i++) {
sb.append(String.format("3 × %2d = %2d", i, 3*i));
sb.append("<br />");
}
%>
<%=
sb.toString()
%>
</body>
</html>