SpringBoot学习-引入thymeleaf

为什么要thymeleaf?

SpringBoot不支持jsp,可以引入模板引擎来代替使用
JSP、Velocity、Freemarker、Thymeleaf等都是模板引擎
SpringBoot推荐我们使用Thymeleaf;

怎么引入?

在官方文档中找到场景启动器Starters
SpringBoot学习-引入thymeleaf_第1张图片
然后在pom.xml中引进来就可以了


        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-thymeleafartifactId>
        dependency>

maven会自动帮我们把jar包导进来,版本不用写它会自动识别
如果想切换版本:
标签中指明想要覆盖的版本就可以了
比如我想切换为3.0.9.RELEASE这个版本,版本可以去GitHub中看

<properties>
	<thymeleaf.version>3.0.9.RELEASEthymeleaf.version>
	<!‐‐ 布局功能的支持程序 thymeleaf3主程序 layout2以上版本 ‐‐>
	<!‐‐ thymeleaf2 layout1‐‐>
	<thymeleaf‐layout‐dialect.version>2.2.2thymeleaf‐layout‐dialect.version>
properties>

你可能感兴趣的:(SpringBoot)