I can't collect POJO subobject from html using thymeleaf

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I can't collect POJO subobject from html using thymeleaf

                        <td_><input type="text" class="form-control" th:field="*{books[__${rowStat.index}__].title}"/></td_>
                        </tr_>
                </table_>
</form_>

------------------Controller ----------
 private String savePagePost (Model model,
                                 Author author){ /*some code*/}

in debag I catch some thing like this:
    Author(authName=Artur, books[])

construction th:field doesn't work in my project. I use spring-boot-starter-thymeleaf:2.0.0.M5
how can i release this. may bee someone has better example.
vitaly
Hi, every one! I can't collect data form subobject. for example:
POJO
class Author{
     private String authName;
     private Set<Books> books;
}
class Book{
private String title;
}
----------- form ----------
<form_ th:object="${author}">
     <input_ type="text" name="authName"/>
   
    <table_>
                <tr_>
                    <th_ class="col-sm-1">                    <th_ class="col-sm-1">book title                </tr_>
                    <tr_ th:each="book, rowStat : *{books}">
                        <td_>