1,th:属性名="",就可以直接修改控件的属性,比如
<input th:type="button" th:name="xinxin" th:value="caddice"/>等等...
2,th:each="xx,xxStat:${后台传来的值}",th:text="${xx.属性}"可以把传来的集合遍历出来,比如
<table> <tr> <td colspan="2">人员信息列表</td> </tr> <tr th:each="person,personStat:${persons}"> <td th:text="${person.name}"></td> <td th:text="${person.age}"></td> </tr> </table>
这样就能看到一个列表了。personStat里面装的是当前person的一些状态信息,比如角标之类的。不需要的话可以直接写成<tr th:each="person:${persons}">
3,th:object="${对象}",th:field="*{属性}"可以直接用属性名调用对象的值,比如
<table th:object="${person}"> <tr> <td colspan="2">个人信息</td> </tr> <tr> <td>姓名:</td> <td th:field="*{name}"></td> </tr> <tr> <td>年龄:</td> <td th:field="*{age}"></td> </tr> </table>
这样可以把person的任意属性提出来
*注:要灵活运用,尤其是$与*符号:如果是从后台传过来的,要用$;如果是th:object这种对象里的,则用*
原文:http://www.cnblogs.com/brook1223/p/5067365.html