<html lang="en" xmlns:th="http://www.thymeleaf.org">
*文本text区别html
<!--区别一个不能够解析标签,--> <h1 th:text="${title}">欢迎</h1> <!--区别一个可解析标签--> <h1 th:utext="${title}">欢迎</h1>
*循环获取 text的值code
<h3 th:each="name:${data}" th:text="${name}">在这显示名字</h3>
*处理网址orm
<a href="" th:href="@{/user}">点我</a>
*a 标签的链接写法
在配置文件中配置通用地址server
server.servlet.context-path=/dev
a 标签会自动在前面加上这个地址xml
<!--链接写法--> <!--这种写法会在前面自动拼接context-path--> <a href="" th:href="@{/dep/list}">对的连接/dep/list</a>
*form表单htm
<form action="" th:action="@{/user}"> <input type="text" name="" th:value="${name}"> </form>
*fragment 与replace, includeinput
fragment 是写通用片断的 建立一个html 专写它servlet
<div class="fg" th:fragment="footer" > <h1>首页</h1> </div>
在其余页面调取it
replace 与include 的区别io
<!--引入片断--> <!--替换 保留的内层标签--> <div class="emp" th:replace="fragmets::footer"></div> <!--导入 保留的外层标签--> <div class="emp" th:include="fragmets::footer"></div>