Here's my code, where I'm iterating through:
<tr th:each="category : ${categories}">      <td th:text="${category.idCategory}"></td>      <td th:text="${category.name}"></td>      <td>          <a th:href="@{'/category/edit/' + ${category.id}}">view</a>      </td> </tr>   The URL it points to is supposed to be /category/edit/<id of the category>, but it says it could not parse the expression:
Exception evaluating SpringEL expression: "category.id" (category-list:21)
Request parameters can be easily accessed in Thymeleaf views. Request parameters are passed from the client to server like: https://example.com/query?q=Thymeleaf+Is+Great! In the above example if parameter q is not present, empty string will be displayed in the above paragraph otherwise the value of q will be shown.
We can use the th:with attribute to declare local variables in Thymeleaf templates. A local variable in Thymeleaf is only available for evaluation on all children inside the bounds of the HTML tag that declares it.
We use th:action to provide the form action URL and th:object to specify an object to which the submitted form data will be bound. Individual fields are mapped using the th:field=”*{name}” attribute, where the name is the matching property of the object.
The right way according to Thymeleaf documention for adding parameters is:
<a th:href="@{/category/edit/{id}(id=${category.idCategory})}">view</a> 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With