So I'm trying to generate (dynamic) links through Thymeleaf.
Now the first url I want to link to is /resource/id so I have the following:
<a th:href="|/resource/${resource.id}|" href="#" class="btn btn-default">Edit...</a>
Which works great, and does exactly what you would expect.
So the next url I want to link to is /resource/id/child/id so I try the following:
<a th:href="|/resource/${resource.id}/child/${child.id}|" href="#" class="btn btn-default">Edit...</a>
Which I thought would give me what I wanted. Instead I get:
/resource/3/child%7D?id=4
Which is weird and confusing. I'm not really sure why this happens or how to get what I want which is:
/resource/3/child/4
Any help greatly appreciated. I'm using spring-boot/spring-mvc if it makes any difference.
Update: Okay, so after re-reading (and comprehending) the documentation, it turns out the the more correct syntax is:
<a th:href="@{/resource/{rid}/child/{cid}(rid=${resource.id} cid=${child.id})}" href="#" class="btn btn-default">Edit...</a>
Now I get the url:
/resource/3/child?id=4
Which while very close is still slightly wrong and confusing.
Does Thymeleaf not support more than one path variable?