Fork me on GitHub

在threamleaf中使用循环遍历输出list集合

1,拿到需要输出的对象集合

List<Object> bankinfos= new ArrayList<>();

bankinfos.add(new Object("bank":"工商银行,"account”:"123654569874563215"));

bankinfos.add(new Object("bank":"建设银行,"account”:"123654569874563215"));


2,html页面
<table>
<tr>
<td>银行</td>
<td>账号</td>
</tr>
<tr th:each="bankinfo : ${bankinfos}">
<td><input type="text" th:value="${bankinfo.bank}"/></td>
<td><input type="text" th:value="${bankinfo.account}"></td>
</tr>
</table>

3,结果

银行 账号
工商银行 1236545789654526545
建设银行 1236547856987456589






posted @ 2020-07-30 17:04  涛声-依旧  阅读(467)  评论(0编辑  收藏  举报