SpringBoot學習-引入thymeleaf
阿新 • • 發佈:2018-11-06
為什麼要thymeleaf?
SpringBoot不支援jsp,可以引入模板引擎來代替使用
JSP、Velocity、Freemarker、Thymeleaf等都是模板引擎
SpringBoot推薦我們使用Thymeleaf;
怎麼引入?
在官方文件中找到場景啟動器Starters
然後在pom.xml中引進來就可以了
<!--引入thymeleaf-->
<dependency>
<groupId>org.springframework.boot</groupId>
< artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
maven會自動幫我們把jar包導進來,版本不用寫它會自動識別
如果想切換版本:
在<properties>
標籤中指明想要覆蓋的版本就可以了
比如我想切換為3.0.9.RELEASE
這個版本,版本可以去GitHub
中看
<properties>
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<!‐‐ 佈局功能的支援程式 thymeleaf3主程式 layout2以上版本 ‐‐>
<!‐‐ thymeleaf2 layout1‐‐>
<thymeleaf‐layout‐dialect.version>2.2.2</thymeleaf‐layout‐dialect.version>
</properties>