0

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";

1 Answer 1

1

In the code sample you have shown as not working, try using the following

<td th:text="${person.getItemName()}">Full Name</td>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.