html0을 통해 구조와 연결을 확인했고 JPA를 이용해 View에서 DB까지 개발을 목적으로 진행한다
Controller
에 관해@RestController
로 진행해 Controller에서 어떻게 .html로 이동할까 의문이었다@Controller
는 View 형식을 사용하는 것이 목적이고 @RestController
의 경우 json, xml file return 목적이기에 @Controller
로 수정해서 진행@RestController
에서 View?@RestController
를 사용했을 때 .html로 넘어가기 위해서는 ModelAndView
객체를 사용해야 하는 것을 알 수 있었다<input type="hidden" name="_method" value="PUT"/>
을 기입해 개선하려했지만 왠지 모르게 정상 작동하지 않았고 이유는 application.properties
에 spring.mvc.hiddenmethod.filter.enabled=true
설정을 추가하지 않았기 때문이었다체크 : ModelAndView [view="allSearch.html"; model={peoples=[Peoples(id=3, name=변변경익제), Peoples(id=4, name=해익제), Peoples(id=5, name=뉴익제), Peoples(id=6, name="재교체익제"), Peoples(id=7, name=1234), Peoples(id=8, name=기미기미), Peoples(id=9, name=앗살라익제), Peoples(id=10, name=성공익제)]}]
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<span th:text="${peoples}"></span>
<br><br><br><br>
</div>
</body>
</html>