thymeleaf常用注解

th:action

th:action="@{/text-templates/form}"  #重新定义action的提交URL

th:method

th:method="post" #用于定义提交的方法

th:object

<form id="login-form" th:action="@{/login}" th:object="${loginBean}">...</form>
即form里的表单项的name="xxx" 与loginBean里的属性字段能够对应上

th:value

<input th:value = "${user.name}" />
th:value="*{name}"                                 给属性赋值

th:test

文本替换<p th:text="${collect.description}">description</p>

猜你喜欢

转载自blog.csdn.net/maqingbin8888/article/details/82142062