2014년 4월 14일 월요일

[Java]Basic타입의 구구단 출력

1. dan_form.html
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="EUC-KR">
  5. <title>Insert title here</title>
  6. </head>
  7. <body>
  8.     <!--
  9.     1.one_view.jsp - garbage
  10.      -->
  11.     <form method="post" action="/Three">
  12.         단을 입력하세요
  13.         <input type="text" name="dan">
  14.         <input type="submit">
  15.     </form>
  16. </body>
  17. </html>
2. one_view.jsp
  1. <%@ page language="java" contentType="text/html; charset=EUC-KR"
  2.     pageEncoding="EUC-KR"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
  7. <title>Insert title here</title>
  8. </head>
  9. <body>
  10. <%
  11.     int dan = Integer.parseInt(request.getParameter("dan"));
  12.     for(int i=1; i<10; i++){
  13.         out.print(dan+"*"+i+"="+(dan*i)+"<br>");
  14.     }
  15. %>
  16. </body>
  17. </html>

댓글 없음:

댓글 쓰기