使用Spring和Thymeleaf时,建议使用以下项目结构:
src |-main |-resources|-static| |-css| |-bootstrap.min.css| |-application.css| |-images| |-js| |-jquery-3.1.1.js|-templates
然后,在模板中包含不同的资源将如下所示:
<head> <link href="../static/css/bootstrap.min.css" rel="stylesheet" media="screen" th:href="@{/css/bootstrap.css}"/> <link href="../static/css/application.css" rel="stylesheet" media="screen" th:href="@{/css/application.css}"/> <script src="../static/js/jquery-3.1.1.js" th:src="@{/js/jquery-3.1.1.js}"></script></head>


