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="gray">
<h3>로그인 입력 폼 페이지</h3>
<hr width="30%" color="gray">
<br> <br>
<form method="post" action="<%= request.getContextPath() %>/loginOk">
<table border="1" width="350">
<tr>
<th>아이디</th>
<td><input name="userId"></td>
</tr>
<tr>
<th>비밀번호</th>
<td><input type="password" name="userPwd"></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"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<hr width="30%" color="maroon">
<h3>로그인 정보 페이지</h3>
<hr width="30%" color="maroon">
<br> <br>
<table border="1" width="350">
<tr>
<th>아이디</th>
<td>${ id }</td>
</tr>
<tr>
<th>비밀번호</th>
<td>${ pwd }</td>
</tr>
</table>
</div>
</body>
</html>
package com.spring.mvc02;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class MyController {
@RequestMapping("login")
public String bbb() {
return "loginForm";
}
@RequestMapping("loginOk")
public String ccc(
@RequestParam("userId") String user_id,
@RequestParam("userPwd") String user_pwd,
Model model) {
model.addAttribute("id", user_id)
.addAttribute("pwd", user_pwd);
return "result";
}
}'Spring, Boot > 기초 내용 정리' 카테고리의 다른 글
| Spring(JDBC)_00 (1) | 2025.01.22 |
|---|---|
| Spring(MVC)_03_01 (0) | 2025.01.22 |
| Spring(MVC)_02_01 (0) | 2025.01.22 |
| Spring(MVC)_01_03 (0) | 2025.01.22 |
| Spring(MVC)_01_02 (0) | 2025.01.22 |