当前位置:首页 > 技术杂谈 > 正文

thymeleaf模板引擎

2024-03-31 技术杂谈

Springboot需要使用thymeleaf模板引擎来编写前端页面,代替了SSM中的JSP

controller的return页面的路径,默认为resources下的template

 

查看thymeleaf的配置文件,在template下默认使用.html页面

 

 

thymeleaf的语法:

在html中导入thymeleaf的命名空间

xmlns:th="http://www.thymeleaf.org"

 

获取后端数据并展示

 

 

遍历取值 

 

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/a/17371.html