i have problem with display my items from database. I assign my item object to ArrayList and want to display it in html file, every time when I try display it, i have Whitelabel Error Page. When i display this code below its worked but iteration not.
HTML:
<span th:text="${item.get(0).getItemName()}"></span>
^ working
<tr th:each="person, state : ${item}" class="row" th:classappend="${state.odd} ? 'odd-row' : 'even-row'">
<td th:utext="${item.getItemName()}">Full Name</td>
</tr>
^ Not working
Java:
List<item> item = new ArrayList<>();
itemRepository.findAll().forEach(item::add);
List<item> findList = new ArrayList<item>();
for (int i = 0; i < item.size(); i++) {
if(item.get(i).getWhoAdd().equals(isExist.getId())){
findList.add(item.get(i));
}
}
model.addAttribute("item",findList);
return "item";