구구단 입력받아 출력 페이지 간 연결 아웃라인 - soonbeankim/web1 GitHub Wiki

구구단 출력 단 입력하세요

테두리 면마다 다른색주기

<div style="border-top:2px solid blue; border-bottom:2px solid red; 
border-left:2px solid chartreuse; border-right:2px solid yellow; padding:10px;">
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>구구단</title>
</head>
<style type="text/css">
.my-gugu { border:1px solid; padding:10px; }
</style>

<body>
<div class="my-gugu">
<form action="Gugu_02.jsp" method="get">
몇단? :<input type="text" name="gugu">
<input type="submit" value="OK">
</form>

</div>
</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>
<div style="border:1px solid purple; padding:10px;">
<%
	request.setCharacterEncoding("utf-8");
	int gugu = Integer.parseInt(request.getParameter("gugu"));
	%>
<%= gugu%>단 <br/>
<%	
for(int i=1; i<=9; i++){
		
		
		out.println(gugu+"X"+i+"=");
		out.println(String.format("%, 5d", gugu*i)+"<br/>");
		
	}
	
%>

<table>
			<tr>
			<td colspan="2"><%=gugu %>단</td>
			</tr>
	<%
		for(int i=1; i<=9; i++){
	%>
			
			<tr>
				<td><%=gugu %>X<%=i %>=</td>
				<td align="right"><%=gugu*i %>
			</tr>
			
	<% 	
		}
	%>
	
</table>


<form action="Gugu_01.jsp">
<input type="submit" value="돌아가기">
</form>

</div>
</body>
</html>
⚠️ **GitHub.com Fallback** ⚠️