1.th:text 예제 사용법

dto 패키지에 ItemDto.class 파일을 생성해줍니다.
그럼 다음

controller 패키지에 ThymeleafExController.java 파일을 생성합니다.
생성후 url -> @GetMapping /ex02 -> thymeleafExample02 메소드에 방금전 생성했던 ItemDto를 set로 값을 넣습니다. 넣은후 Model에 데이터를 담습니다.
return 값으로 thymeleafEx -> thymeleafEx02.html에 데이터를 보냅니다.

위와 같이 사진 화면을 보시면 Thymeleaf 문법에 th:text으로 사용하는걸 확인할수 있습니다.

데이터를 잘 나온걸 확인할수 있습니다. 감사합니다.
'BackEnd > SpringBoot' 카테고리의 다른 글
머스테치 (0) | 2022.04.24 |
---|---|
Spring Security (0) | 2022.04.13 |
Thymeleaf 페이지 레이아웃 적용 (0) | 2022.04.13 |
Thymeleaf th:each (0) | 2022.04.12 |
Thymeleaf (0) | 2022.04.12 |