form.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<h1>다음에 좌표값을 입력 하세요.</h1>
<form action="./action.jsp">
<div>
<label for="x">x : </label>
<input type="text" name="x">
</div>
<div>
<label for="y">y : </label>
<input type="text" name="y">
</div>
<button type="submit">전송</button>
</form>
</body>
</html>
service/Point.java
package service;
public class Point {
public String x;
public String y;
}
action.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ page import="service.Point" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<%
Point point = new Point();
point.x = request.getParameter("x");
point.y = request.getParameter("y");
%>
<h3>form.jsp에서 넘겨받은 좌표값</h3>
<table >
<thead>
<tr>
<td>x</td>
<td>y</td>
</tr>
</thead>
<tbody>
<tr>
<td><%=point.x%></td>
<td><%=point.y%></td>
</tr>
</tbody>
</table>
</body>
</html>
'3. 변수, 상수, 데이터 타입' 카테고리의 다른 글
5) 클래스 타입의 배열 만들기 (0) | 2019.07.30 |
---|---|
4) 문자열 타입(String 타입)의 배열 만들기 (0) | 2019.07.30 |
3) 다른 패키지에 클래스(타입) 만들기 (0) | 2019.07.30 |
2) 데이터 타입 (0) | 2019.07.23 |
1) 변수와 상수 (0) | 2019.07.23 |