코드 3-15 독서 목록 애플리케이션용 사용자 오류 페이지(resources/templates/error.html)
<!DOCTYPE html> <html> <head> <title>Oops!</title> <link rel="stylesheet" th:href="@{/css/style.css}"></link> </head> <body> <div class="errorPage"> <span class="oops">Oops!</span><br /> <img th:src="@{/images/MissingPage.png}"></img> <p>There seems to be a problem with the page you requested <span th:text="${path}"></span>).</p> <!-- 요청 경로 표시 --> <p th:text="${'Details: ' + message}"></p> <!-- 상세한 오류 표시 --> </div> </body> </htl>
이 사용자 오류 템플릿을 error.html로 저장하고 Thymeleaf 템플릿 리졸버가 찾을 수 있도록 템플릿 디렉터리에 둬야 한다. 일반적으로 메이븐이나 그레이들 빌드에서는 템플릿이 클래스패스의 루트에 있도록 src/main/resources/templates 디렉터리에 두는 것을 의미한다.