我正在尝试遍历百里香叶中的列表并显示值,但出现错误
Exception processing template "customers/Customers": Exception evaluating SpringEL expression: "list.customerid" (customers/Customers:94)
EL1008E:(pos 5): Property or field 'customerid' cannot be found on object of type 'java.util.LinkedHashMap' - maybe not public?
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
List<CustomerAccounts> acountsList = custService.findCustomer(mobilenumber, accountnumber);
System.out.println("acountsList size:-"+acountsList.size());
if(acountsList.size() != 0){
for(CustomerAccounts custAccounts :acountsList){
DcbCustomerAccount accountMaster = custService.findAccountMaster(custAccounts.getMobilenumber().substring(2), custAccounts.getAccountNumber());
Map<String, Object> map = new LinkedHashMap<String, Object>();
if(accountMaster !=null){
System.out.println("Customer Id:"+accountMaster.getId().getCustomerid());
map.put("customerid", accountMaster.getId().getCustomerid());
map.put("name", custAccounts.getName());
map.put("accountNumber", custAccounts.getAccountNumber());
map.put("mobilenumber", custAccounts.getMobilenumber());
map.put("createdDate", custAccounts.getCreatedDate());
map.put("status", "Activated");
}
list.add(map);
}
System.out.println("List Size:-"+list.size());
model.addAttribute("acountsList", list);
}
<tr th:each="list,iterStat : ${acountsList}">
<!-- <td th:text="${list.id}">CustomerID</td> -->
<td th:text="${list.customerid}">CustomerID</td>
<td th:text="${list.name}">Customer Name</td>
<td th:text="${list.accountNumber}">Account Number</td>
<td th:text="${list.mobilenumber}">Mobile Number</td>
<td th:text="${list.createdDate}">Created Date</td>
<td th:text="${list.status}">Created Date</td>
</tr>
我正在尝试将值放在map中并添加到列表中。最后列表对象的返回是model
属性。
我的代码有什么问题?