jsp和thymeleaf模板

jsp

解析jsp页面的依赖
tomcat-embed-jasper

标签库 jstl

内嵌容器部署到IDEA的临时目录里
不包含jsp页面

设置工作路径为:module...dirs


thymeleaf (boot默认模板)

无需部署到web容器,可在页面直接查看
也可在服务器带数据,查看动态效果

spring:
resources:
static-locations: classpath: //设置静态路径

xmlns:th="http://www.thymeleaf.org //引入命名空间

th:href="@{xxx.css}" th:src="@{xxx.js}" //引入外部资源

th:utext="${xxx}" //编译xxx(含标签)内容

<ul th:each="emp,status:${people}"> //循环多数据显示

${#dates.format(emp.bir,'yyyy年MM月dd日')} //格式日期

th:if="${变量} eq 值" //条件运算符 gt ge eq lt le (great,less,than)

原文地址:https://www.cnblogs.com/mo-jian-ming/p/13458954.html