8 定义布局变量th:with属性的用法
可以一次性定义多个变量,以逗号隔开
<div th:with="firstPer=${list[0]}">
<p>The name of the first person is <span th:text="${firstPer.userName}">Julius Caesar</span>.</p>
</div>
<div th:with="firstPer=${list[0]},secondPer=${list[1]}">
<p>The name of the first person is <span th:text="${firstPer.userName}">Julius Caesar</span>.</p>
<p> But the name of the second person is <span th:text="${secondPer.userName}">Marcus Antonius</span>.
</p>
</div>
也可以在语句中重复使用,如:
<div th:with="company=${user.company},account=${accounts[company]}">
<div th:text="${company}"></div>
<div th:text="${account}"></div>
</div>