Как передать всю таблицу с формы ввода

Имеется класс:

public class User {
    private String name;
    private int age;
...
}

Как мне сделать, чтобы в таблице с данными можно было вносить исправления и передавать их методом Post. так не работает:

<form th:method="POST" th:action="@{/user/new}" th:object="${userNew}">
    <div class="form-row">
        <table class="table table-bordered table-dark" id="table-prd-add-name">
            <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">Имя</th>
                    <th scope="col">Возвраст</th>
                </tr>
            </thead>
                <tbody>
                    <tr th:each="user, state : ${userList}">
                        <th th:utext="${state.count}">No</th>
                        <td th:text="${user.name}">name</td>
                        <td th:text="${user.age}">age</td>
                    </tr>
               
                </tbody>
            </table>
    </div>
    <button type="submit" class="btn btn-primary">Сохранить</button>
</form>

Controller:

@GetMapping(value = "/add-user")
public String showUser(Model model) {
   ...
   model.addAttribute("userList", userList);
   return "add-user";
}

@PostMapping(value = "/user/new")
public String addUser(
   @ModelAttribute("users") ArrayList<User> users)) {
 ...

}

Ответы (0 шт):