본문 바로가기

JSP

[JSP/JAVA]구구단 샘플예제.

반응형
<%@ 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>
  <center>
    <h2>gugudan</h2>
    <table border=1 width=560>
      <tr bgcolor=#ccccff>
        <%
          for(int i=2; i<=9; i++)
          {
        %>
              <td> <%= i+"dan" %> </td>
        <%            
          }
        %>
      </tr>
      
      <%
        for(int i=1; i<=9; i++) // 줄수
        {
      %>
            <tr> 
      <%
            for(int j=2; j<=9; j++)
            {
      %>
                <td><%= j+"X"+i+"="+j*i %></td>
      <%
            }
      %>
             </tr>
      <%
        }
      %>
    </table>  
  
  </center>

</body>
</html>

jsp 를 통한 구구단 예제 샘플


반응형