2025-01-22








<%@ 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 align="center">
<hr width="30%" color="blue">
<h3>회원 가입 입력 폼 페이지</h3>
<hr width="30%" color="blue">
<br> <br>
<form method="post" action="<%=request.getContextPath() %>/join_ok">
<table border="1" width="350">
<tr>
<th>회원 아이디</th>
<td><input name="id"></td>
</tr>
<tr>
<th>회원 이름</th>
<td><input name="name"></td>
</tr>
<tr>
<th>회원 비밀번호</th>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<th>회원 나이</th>
<td><input name="age"></td>
</tr>
<tr>
<th>회원 연락처</th>
<td><input name="phone"></td>
</tr>
<tr>
<th>회원 이메일</th>
<td><input name="email"></td>
</tr>
<tr>
<th>회원 주소</th>
<td><input name="addr"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="회원가입">
<input type="reset" value="취소">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<hr width="30%" color="red">
<h3>회원가입 정보 페이지</h3>
<hr width="30%" color="red">
<br> <br>
<table border="1" width="300">
<c:set var="dto" value="${Member }"/>
<c:if test="${!empty dto }">
<tr>
<th>회원 아이디</th>
<td>${dto.id }</td>
</tr>
<tr>
<th>회원 이름</th>
<td>${dto.name }</td>
</tr>
<tr>
<th>회원 비밀번호</th>
<td>${dto.pwd }</td>
</tr>
<tr>
<th>회원 나이</th>
<td>${dto.age } 세</td>
</tr>
<tr>
<th>회원 연락처</th>
<td>${dto.phone }</td>
</tr>
<tr>
<th>회원 이메일</th>
<td>${dto.email }</td>
</tr>
<tr>
<th>회원 주소</th>
<td>${dto.addr }</td>
</tr>
</c:if>
<c:if test="${empty dto }">
<tr>
<td colspan="2" align="center">
<h3>회원에 대한 정보가 없습니다...</h3>
</td>
</tr>
</c:if>
</table>
</div>
</body>
</html>
package com.spring.mvc03;
import lombok.Data;
@Data
public class Member {
private String id;
private String name;
private String pwd;
private int age;
private String phone;
private String email;
private String addr;
}
package com.spring.mvc03;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MyController {
@RequestMapping("join")
public String abc() {
return "join";
}
@RequestMapping("join_ok")
public String join(Member member, Model model) {
model.addAttribute("Member", member);
return "joinInfo";
}
}'Spring, Boot > 기초 내용 정리' 카테고리의 다른 글
| Spring(JDBC)_01 (1) | 2025.01.22 |
|---|---|
| Spring(JDBC)_00 (1) | 2025.01.22 |
| Spring(MVC)_02_02 (0) | 2025.01.22 |
| Spring(MVC)_02_01 (0) | 2025.01.22 |
| Spring(MVC)_01_03 (0) | 2025.01.22 |