thymeleaf (1) 썸네일형 리스트형 [SpringBoot] Contoller와 View의 데이터 전달 : Thymeleaf 템플릿 1. Contoller Contoller 에서 Model 을 이용하여 데이터를 View 로 전달한다. addAttribute 메서드를 이용하는 데, 첫 번째 파라미터는 변수명, 두 번째 파라미터는 값을 나타낸다. return 하는 값은 View 의 파일명이다. @Controller public class HelloController { @GetMapping("hello") public String hello(Model model) { model.addAttribute("data", "hello!!!"); return "hello"; } } 2. hello.html 안녕하세요, 손님 Thyemleaf 템플릿 엔진을 이용하기 위해선 xml 네임 스페이스를 명시해야 한다. html 태그를 열고 xmlns:th.. 이전 1 다음