기록해! 정리해!

thymeleaf - getBoardList 본문

SpringBoot

thymeleaf - getBoardList

zsuling 2022. 10. 14. 11:09

1. getBoardList

<html xmlns:th="http://www.thymeleaaf.org">
<head>

</head>
<body>
<div align="center">
<h2>목록보기 ( <a href=index.html>처음으로</a> )</h2>
<table border=1 >
<tr align="center"> 
 <th > 번호 </th> <th> 이름 </th> <th> 국어 </th>
 <th> 영어 </th> <th> 수학 </th> <th> 역사 </th>
</tr>

<tr align="center" th:each="m : ${li}"> 
 <td th:text="${m.sno}" />
 <td th:text="${m.sname}" />
 <td th:text="${m.kor}" />
 <td th:text="${m.eng}" />
 <td th:text="${m.math}" />
 <td th:text="${m.hist}" />
 </tr>

</table>

</div>
</body>

</html>

2.

- BoardController

package com.rubypaper.controller;

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

import com.rubypaper.exam.ExamServiceImpl;
import com.rubypaper.exam.ExamVO;

@Controller
public class BoardController {
    
    @Autowired
	private ExamServiceImpl  service;
    
    @RequestMapping("/hello.do")
	public void hello(Model model) {
		model.addAttribute("greeting", "Hello 타임리프");
	}
	
	@RequestMapping("/getBoardList.do") 
	public void getBoardList(ExamVO vo, Model  model){	
		System.out.println("===> getBoardList 확인");

		model.addAttribute("li", service.getExamList(vo))	;
	}	
		

}

- mapper와 Exam~은 MyBatisWar2를 복사해옴, 

 

3. index.html

다 do로 맞춰줌

 

결과

 

'SpringBoot' 카테고리의 다른 글

thymeleaf - getBoard 상세보기+delete  (0) 2022.10.14
thymeleaf - getBoardList 링크  (0) 2022.10.14
thymeleaf - hello  (0) 2022.10.14
myBatis2 (7)- 자료실(사진삭제, space.jpg)  (0) 2022.10.13
myBatis2 (6)- 자료실(사진)  (0) 2022.10.13
Comments