thymeleaf前端通用格式


<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" media="all"
href="../../webapp/static/css/style.css"
th:href="@{/static/css/style.css}" />
<link rel="stylesheet" type="text/css" media="all"
href="../../webapp/static/layui/css/layui.css"
th:href="@{/static/layui/css/layui.css}" />
<script type="text/javascript" src="../../webapp/static/js/userList.js"
th:src="@{/static/js/userList.js}"></script>
<script type="text/javascript" src="../../webapp/static/layui/layui.js"
th:src="@{/static/layui/layui.js}"></script>
<script src="./static/js/jquery.min.js" th:src="@{/static/js/jquery.min.js}"></script>
</head>
<script></script>
<style></style>
<body>
</body>
</html>

文檔目錄

pom配置

<!-- thymeleaf 支持 --> 
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- thymeleaf legacyhtml5 模式支持 --> 
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>

application.properties配置thymeleaf

#thymeleaf 配置
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
#緩存設置為false, 這樣修改之后馬上生效,便於調試
spring.thymeleaf.cache=false
#上下文
server.context-path=/thymeleaf

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM