thymeleaf语法
程序员文章站
2022-05-01 22:54:51
...
${...}
: 变量表达式。*{...}
: 选择表达式。#{...}
: 消息 (i18n) 表达式。@{...}
: 链接 (URL) 表达式。~{...}
: 片段表达式。-
<!--显示对象的属性值--> <span th:text="${book.author.name}">
-
<!--遍历books--> 迭代遍历:<li th:each="book : ${books}">
-
消息(i18n)表达式:消息表达式(通常称为文本外部化,国际化或i18n)允许从外部源。(如:
.properties
)文件中检索特定于语言环境的消息,通过键来引用这引用消息。<table> ... <th th:text="#{header.address.city}">...</th> <th th:text="#{header.address.country}">...</th> ... </table>
- 普通超链接:<a th:href="@{/order/list}">...</a>
- 带一个参数:<a th:href="@{/order/details(id=3)}">
- 带多个参数:<a th:href="@{/order/details(id=3,action='show_all')}">
上一篇: 非严格的thymeleaf格式
下一篇: 严格模式