Springboot加载thymeleaf模板引擎

第一步:pom文件引入thymeleaf模板引擎依赖。

Springboot加载thymeleaf模板引擎

第二步:在resources目录中的templates目录中新建html页面。

Springboot加载thymeleaf模板引擎

第三步:通过编写的Controller类来执行html页面的跳转,注意:在templates目录下的所有页面,只能通过controller来跳转。

Springboot加载thymeleaf模板引擎 第四步:浏览器中访问获得页面。

Springboot加载thymeleaf模板引擎

第五步:动态传递数据。

Springboot加载thymeleaf模板引擎

Springboot加载thymeleaf模板引擎 Springboot加载thymeleaf模板引擎