Fragment rendering

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Fragment rendering

I am pretty new to Thymeleaf and I need to do a ajax call to request the details of a person.

I have the request sent to the controller and the data coming back to the client in format like:

surname : Smith
firstname : John

On the html on the input I had something ilke:

Input name="surname" th:field=*{person[0].surname)

Note that I was expecting the JSON name and the field name to be the Same! So then I was going to use jquery to do :

var $theForm = $(this).closest('.panel-body');

The issue I have discovered is that thymeleaf renames the name field to the same as the th:field

How should I handle this situation?


Reply | Threaded
Open this post in threaded view

Re: Fragment rendering

Maybe you can use th:value instead of th:field?