2
<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

user2477
  • 896
  • 2
  • 10
  • 23

1 Answers1

2

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>
Metroids
  • 18,999
  • 4
  • 41
  • 52