[thymeleaf 3.x] th:href then add a query parameter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[thymeleaf 3.x] th:href then add a query parameter

BeRoots
Hi :)

I try to write a new url like this: th:href="@{${#request.requestURL}(foo='bar')}"
It works fine but override all query string parameters if exists and in this case I want to preserve it and add the new one.

Example: If my current url is localhost:8080/home?id=1 I want to change like localhost:8080/home?id=1&foo=bar but with my code, the url is localhost:8080/home?foo=bar and the id parameter is deleted.

If someone have an idea ;)