Search code examples
javaspringthymeleaf

How to refer to fields containing "_" in Thymeleaf


I've been trying to edit objects based on the user input. I have two people joined: person and attraction.

There is a field in the attraction called person_id, which is the result of the join and mapping, which I've done in Spring.

My problem is that Thymeleaf is not able to understand this expression.

<input type="hidden" th:value="${attractionToEdit.person_id}">

The other fields of the object can be processed by it, though.

I used Lombok to create the necessary getters and setters. As I've said, my solution worked with the other variables. Could anyone help what can the problem be and how to solve it?


Solution

  • I haven't solved the problem yet, but it's highly likely that the problem is with something entirely different.

    I'll have posted the code this afternoon.