기록해! 정리해!

JPA - Board(Junit -2) 본문

SpringBoot

JPA - Board(Junit -2)

zsuling 2022. 10. 17. 18:11
  • BoardController 생성

- BoardController

package com.rubypaper.board;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class BoardController {

	@Autowired
	private BoardServiceImpl service;
	
	@RequestMapping("/getBoardList.do") 
	public void getBoardList(Board vo, Model  model){	
		model.addAttribute("li", service.getBoardList(vo));
	}	
}

- index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<h2> thymeleaf </h2>
<a href=getBoardList.do>getBoardList 목록보기</a>
</body>
</html>

- getBoardList.html

<html xmlns:th="http://www.thymeleaaf.org">
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<table border=1>
<tr>
<td>IDX</td>
<td>SEQ</td>
<td>TITLE</td>
<td>WRITER</td>
<td>PASSWORD</td>
</tr>

<tr align="center" th:each="m , state : ${li}"> 
<td th:text="${state.count}" /> 
 <td th:text="${m.seq}" />
 <td th:text="${m.title}" />
 <td th:text="${m.writer}" />
 <td th:text="${m.password}" />
 </tr>
 
</table>
</div>
</body>
</html>

>>

Comments