首页 > 其他 > 详细

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

时间:2020-07-30 19:21:17      阅读:130      评论:0      收藏:0      [点我收藏+]

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






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

原文:https://www.cnblogs.com/taosheng-yijiu/p/13404990.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!