th:replace
-
th:replaceThymeleaf 2021. 12. 21. 00:01
th:replace th:replace는 fragment와 함께 쓰이며, fragment 파일 아래에 선언해놓은 html 파일이 치환되는 방식이다. //home.html 위 처럼 home.html에 th:replace를 선언하고 "fragments/header"를 선언해서 경로를 지정해 주면 "fragments/header" 경로에 위치한 파일이 치환되어 실행된다. 자주 사용되는 레이아웃을 적용시킬 때 사용하는 방식인데, 위와 같은 방식은 Include-style layouts 방식이고, old한 방식이며 비효율적이다. Hierarchical-style layouts 방식으로 레이아웃 치환을 더욱 효율적으로 처리할 수 있다. thymeleaf.org/doc/articles/layouts.html 경로에 ..