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 32 33 | <%@ 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>구구단</title> </head> <body> <center><H2>구 구 단</H2> <table border=1 align="center"> <% for(int i=0; i<=9; i++) { %> <%= "<tr>" %> <% for(int j=0; j<=9; j++) { if(i==0 && j==0) { %> <%= "<td width=70 bgcolor=red align=center></td>" %> <% } else if(i==0 && j!=0) { %> <%= "<td width=70 bgcolor=red align=center>" + j + "</td>" %> <% } else if(i!=0 && j==0) { %> <%= "<td width=70 bgcolor=red align=center>" + i + "</td>" %> <% } else { %> <%= "<td align=center>" + j + "x" + i + "=" + j*i + "</td>" %> <% } } %> <%= "</tr>" %> <% } %> </table> </center> </body> </html> | cs |
아래는 실행 화면 입니다.
'Back-End > JSP' 카테고리의 다른 글
[JSP] include액션을 이용한 화면 꾸미기 (template) (0) | 2018.04.16 |
---|---|
[JSP] 구구단 만들기 (1) | 2018.04.16 |
[JSP] 쇼핑몰 장바구니 기능 (DB연동 x) (0) | 2018.04.13 |
[JSP] (get방식) sendRedirect로 Parameter값 넘기는 방법 (4) | 2018.04.12 |
[JSP] 영역(Scope)과 속성(Attribute) 개념정리 (2) | 2018.04.12 |