'Thymeleaf, how to add param with default value if it is missing?
I have two params, sortField and sortDir, this links adds a new one category and sets value to it.
<ul th:with="urlBuilder=
${T(org.springframework.web.servlet.support.ServletUriComponentsBuilder).fromCurrentRequest()}"
<li><a th:href="@{${urlBuilder.replaceQueryParam('category', 'snacks').build().toUriString()}}"
Is it possible to add also sortField and sortDir params with some default values using this link only if they are not already in the url?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
