******* Intro11.jsp *******
<%@ 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>
<form>
행 : <input type="text" name="rows"><p/>
열 : <input type="text" name="cols"><p/>
<input type="submit" value="확인"><p/>
</form>
<%
int rows =1, cols=1;
//만약 폼변수 rows과 cols가 null이 아니라면.
if(request.getParameter("rows") != null && request.getParameter("cols") != null)
{
if(request.getParameter("rows") != "" && request.getParameter("cols") != "")
{
rows=(new Integer(request.getParameter("rows")).intValue());
cols=Integer.parseInt(request.getParameter("cols"));
}
}
%>
<table border="1" width="640">
<%
//반복할것 (1부터 rows까지)
for(int i=1;i<rows+1;i++)
{
%>
<tr>
<%
//반복할것 (1부터 cols까지)
for(int j=1;j<cols+1;j++)
{
%>
<td><%= i %>X<%= j %>=<%= i*j %></td>
<%
}
%>
</tr>
<%
}
%>
</table>
</body>
</html>
************ Intro17.jsp *****************
<%@ 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>
<form method="post" action="Intro17pro.jsp">
행 : <input type="text" name="rows"><p/>
열 : <input type="text" name="cols"><p/>
<input type="submit" value="다음">
</form>
</body>
</html>
******** Intro17pro.jsp **********
<%@ 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">
<%@page import="java.net.URLEncoder"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("euc-kr"); %>
입력한 정보는 아래와 같습니다.
<% String params = "?rows="+ URLEncoder.encode(request.getParameter("rows"))+"&cols="+URLEncoder.encode(request.getParameter("cols")); %>
<form method="post" action="Intro11.jsp">
행 : <%=request.getParameter("rows") %><p>
열 : <%=request.getParameter("cols") %><p>
<input type="hidden" name="rows" value="<%=request.getParameter("rows") %>">
<input type="hidden" name="cols" value="<%=request.getParameter("cols") %>">
<input type="submit" value="다음"><p>
<!--<input type="button" value="location으로 자료전송" OnClick="location='Intro11.jsp?rows=<%= URLEncoder.encode(request.getParameter("rows"))%>&cols=<%= URLEncoder.encode(request.getParameter("cols"))%>';">
<input type="button" value="팝업" onClick="open('Intro11.jsp?rows=<%= URLEncoder.encode(request.getParameter("rows"))%>&cols=<%= URLEncoder.encode(request.getParameter("cols"))%>','intro11','width=640,height=480')">
-->
<input type="button" value="location으로 자료전송" OnClick="location='Intro11.jsp<%= params%>';">
<input type="button" value="팝업" onClick="open('Intro11.jsp<%= params%>','intro11','width=640,height=480')">
</form>
</body>
</html>