
[Spring][Thymeleaf] 공통 레이아웃 적용 (Thymeleaf Layout Dialect)
·
공부/Spring
페이지를 구성하다보면 공통적으로 들어가는 부분이 존재한다. 이러한 공통적인 부분들을 따로 만들어서 각각의 페이지에 끼워넣기만 하면 편리할 것이다. 이를 도와주는 것이 Thymeleaf Layout Dialect이다. build.gradle의 dependencies에 다음 코드를 추가한다. dependencies{ . . . implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' } 타임리프가 이미 추가되어있다면 dialect만 추가하면 된다. 이제 공통 레이아웃을 만들 차례이다. 나는 commons.html 안에 다..