Reputation: 997
<a th:href="@{'delete?id='+${user.id}}">X</a>
When I access /admin
: The url become delete?id=
But when I access /admin/
: The url become admin/delete?id=
(that is the one I want)
So should I use Server-relative URL as an alternative in this case, or should I just assume /admin/
is a wrong URL and use
<a th:href="@{'admin/delete?id='+${user.id}}">X</a>
for /admin
Upvotes: 2
Views: 905
Reputation: 20477
In this case, I think you should be using context relative urls. (Also, you shouldn't building urls using string concatenation -- thymeleaf supports variables.) My recommended syntax:
<a th:href="@{/admin/delete(id=${user.id})}">X</a>
Upvotes: 2