SpringBoot学习-part20 引入模板引擎thymeleaf

    技术2022-07-12  87

    为什么要引入thymeleaf

    SpringBoot以jar包的方式进行打包,使用的是内嵌的tomcat,jsp只能作为静态资源 所以可以使用html,结合模板引擎。 SpringBoot推荐Thymeleaf。

    导入Thymeleaf

    从starters入口进入

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>

    Processed: 0.023, SQL: 9