display data in thymeleaf table using spring-boot

Viewed 3255

I have a table that I want to fill it with data from database using this spring boot controller:

@RequestMapping(value="/list", method = RequestMethod.GET)
public String servicesList(Model model) {
    model.addAttribute("list", appelRepository.findAll());
    return "index";
}

and this is the thymeleaf table:

<table class="table table-bordered" width="100%" id="dataTable" cellspacing="0">
    <thead>
    <tr>
        <th>id</th>
        <th>Service code</th>
        <th>description</th>
        <th>name</th>
        <th>Update</th>
        <th>Delete</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="appel : ${list}">
        <td th:text="${appel.id}"></td>
        <td th:text="${appel.serviceCode}"></td>
        <td th:text="${appel.description}"></td>
        <td th:text="${appel.name}"></td>
        <td><a href="">Update</a></td>
        <td><a href="">Delete</a></td>
    </tr>
    </tbody>
</table>

but nothing seems to work out, the view contain always and empty table, please tell me what to change and how to fix it

0 Answers
Related