728x90
DB์ ๋ฐ์ดํฐ ์ ์ฅํ๊ธฐ
insert into tbl_board(title, content, writer)
values('ํ
์คํธ ์ ๋ชฉ1', 'ํ
์คํธ ๋ด์ฉ', '์์ฑ์');
insert into tbl_board(title, content, writer)
values('ํ
์คํธ ์ ๋ชฉ2', 'ํ
์คํธ ๋ด์ฉ', '์์ฑ์');
insert into tbl_board(title, content, writer)
values('ํ
์คํธ ์ ๋ชฉ3', 'ํ
์คํธ ๋ด์ฉ', '์์ฑ์');
insert into tbl_board(title, content, writer)
values('ํ
์คํธ ์ ๋ชฉ4', 'ํ
์คํธ ๋ด์ฉ', '์์ฑ์');
insert into tbl_board(title, content, writer)
values('ํ
์คํธ ์ ๋ชฉ5', 'ํ
์คํธ ๋ด์ฉ', '์์ฑ์');
select * from tbl_board;

viewsํด๋ ๋ด์ board ํด๋ ์์ฑ ํ
list.jsp ํ์ผ ์์ฑ

์๋จ์ ๋ฐ๋ณต๋ฌธ์ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ฑ


<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>๊ฒ์๋ฌผ ๋ชฉ๋ก</title>
</head>
<body>
<table>
<thead>
<tr>
<th>๋ฒํธ</th>
<th>์ ๋ชฉ</th>
<th>์์ฑ์ผ</th>
<th>์์ฑ์</th>
<th>์กฐํ์</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</body>
</html>
home.jsp์์ list๋ก ์ด๋ํ ์ ์๋ ๋งํฌ ์์ฑ
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
ํฌ๋ก์ฐ ์๋!
</h1>
<P> The time on the server is ${serverTime}. </P>
<p><a href="/board/list">๊ฒ์๋ฌผ ๋ชฉ๋ก</a></p>
</body>
</html>

BoardController ํด๋์ค ์์ฑ
package com.board.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller// ์ปจํธ๋กค๋ฌ ์ ์ธ
@RequestMapping("/board") // ์์ฒญ ์ฃผ์ /board ์ฃผ์๋ง ๋ฃ์ผ๋ฉด ํด๋น ์ปจํธ๋กค๋ฌ๋ก ๋์ด์ด
public class BoardController {
@GetMapping("/list")
public void getList() {
//void๋ฆฌํด ์์ ์ฃผ์๊ฐ๊ณผ ๊ฐ์ .jsp๋ฅผ ์ฐพ๋๋ค. ์ฆ, board/list.jsp๋ฅผ ์ฐพ์
}
}
ํ ์คํธ ํด๋ณด๊ธฐ

728x90
'BACKEND > Spring' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| ๊ฒ์ํ ๋ง๋ค๊ธฐ - write.jsp(๊ฒ์๋ฌผ ์์ฑ) , mapper (0) | 2023.10.23 |
|---|---|
| ๊ฒ์ํ ๋ง๋ค๊ธฐ - mapper๋ง๋ค์ด์, DAO์ Service,Controller์ฐ๊ฒฐ (0) | 2023.10.23 |
| ๊ฒ์ํ ๋ง๋ค๊ธฐ - mapper ํด๋ ๋ด์ sql๋ฌธ ์์ฑํ ํ์ผ ๋ง๋ค๊ธฐ (0) | 2023.10.23 |
| ๊ฒ์ํ ๋ง๋ค๊ธฐ - BoardVO๋ง๋ค๊ธฐ (0) | 2023.10.23 |
| ๊ฒ์ํ ๋ง๋ค๊ธฐ - DB์์ฑ ๋ฐ ์ฐ๊ฒฐ ์ค์ (1) | 2023.10.23 |