Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://example.com/some/page?p1=11
- http://example.com/some/page?p1=11&p2=32
- <a th:href="@{?(p2=32)}">Click here</a>
- <div th:with="currentUrl=(${#httpServletRequest.requestURI + '?' + #strings.defaultString(#httpServletRequest.queryString, '')})">
- <a th:href="@{${currentUrl}(myparam=test)}">click here</a>
- </div>
- http://localhost:8080/some-page?param1=1&myparam=test
- http://localhost:8080/some-page?&myparam=test
- http://localhost:8080/some-page?param1=1&myparam=test&myparam=test
- <div th:with="currentUrl=(${@currentUrlWithoutParam.apply('myparam')})">
- <a th:href="@{${currentUrl}(myparam=test)}">click here</a>
- </div>
- @Bean
- public Function<String, String> currentUrlWithoutParam() {
- return param -> ServletUriComponentsBuilder.fromCurrentRequest().replaceQueryParam(param).toUriString();
- }
- <span th:with="urlBuilder=${T(org.springframework.web.servlet.support.ServletUriComponentsBuilder).fromCurrentRequest()}"
- th:text="${urlBuilder.replaceQueryParam('p2', '32').toUriString()}">
- </span>
- http://example.com/some/page?p1=11&p2=32
- <span th:with="urlBuilder=${T(org.springframework.web.servlet.support.ServletUriComponentsBuilder)}">
- <span th:text="${urlBuilder.fromCurrentRequest().replaceQueryParam('p2', 'whatever').toUriString()}"></span>
- <span th:text="${urlBuilder.fromCurrentRequest().replaceQueryParam('p3', 'whatever').toUriString()}"></span>
- <span th:text="${urlBuilder.fromCurrentRequest().replaceQueryParam('p4', 'whatever').toUriString()}"></span>
- </span>
- http://example.com/some/page?p2=whatever
- http://example.com/some/page?p3=whatever
- http://example.com/some/page?p4=whatever
- <ul class="pagination">
- <li th:if="${currentPage > 1}"><a th:href="'/search?key=' + ${param.key[0]} + '&page=' + ${currentPage-1}">Previous</a></li>
- <li th:each="i : ${#numbers.sequence( 1, total+1)}" th:class="${i==currentPage}?active:''">
- <a th:href="'/search?key=' + ${param.key[0]} + '&page=' + ${i}" th:inline="text">
- [[${i}]] <span class="sr-only">(current)</span>
- </a>
- </li>
- <li><a th:if="${total + 1 > currentPage}" th:href="'/search?key=' + ${param.key[0]} + '&page=' + ${currentPage+1}">Next</a></li>
- </ul>
- th:href="@{/your/link?parameter=__${appendParameter}__}"
Add Comment
Please, Sign In to add comment