我正在尝试浏览数据库中的列表,并将其发布到html表单中。我让它工作的唯一方法是使用下面的代码:
<tr th:each="customer: ${rxReqBean.iCustomer}">
<p type="hidden" th:text="'First Name: ' + ${rxReqBean.iCustomer.get(0).firstName}"/></p>如图所示,我一次又一次地得到相同的名字。有没有办法将其更改为返回数据库中的每个名字?db页是iCustomer对象。
发布于 2018-08-21 22:27:31
问题是您总是通过在${rxReqBean.iCustomer.get(0).firstName}中使用get(0)来引用列表中的第一个客户,您必须使用您的迭代变量:${customer.firstName}。
https://stackoverflow.com/questions/51950818
复制相似问题