接着上一次的配置

1.在pom文件中添加thymeleaf模板的引入,

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

位置如图:

SpringBoot(二)thymeleaf模板的引入

2.在templates包下新建hello.html文件

SpringBoot(二)thymeleaf模板的引入

3.在HelloController中添加,如图

SpringBoot(二)thymeleaf模板的引入

 

启动项目后,访问:http://localhost:8080/zm/hello

SpringBoot(二)thymeleaf模板的引入

 

 总结:只是简单的配置,没有深入,再下一节深入了解一下,thhymeleaf是可以替代jsp的。

相关文章:

  • 2021-04-24
  • 2021-12-13
  • 2021-11-19
  • 2021-08-25
  • 2022-01-01
  • 2021-11-17
  • 2021-10-15
猜你喜欢
  • 2021-11-24
  • 2021-11-13
  • 2022-12-23
  • 2021-07-24
  • 2021-07-14
  • 2022-12-23
相关资源
相似解决方案