bleau83
bleau83

Reputation: 515

continue with previous variable url when a link is pressed

I have a URL that contains a fixed part, followed by an UUID id of an object.

http://localhost:8080/gym/7663e7c4-e3da-4ad3-a652-b00f7d138fb3

I have a button that links to a new page but the URL of the new page must be the same as the url of the current page (incl id) + /review That way, I can get the id info in my mvc controller.

<a class="nav-link" th:href="@{review}">
            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Add review</button>
</a>

When I do this, I always end up with a URL without the id

http://localhost:8080/gym/review

Any idea what I am doing wrong?

Upvotes: 0

Views: 103

Answers (1)

Sully
Sully

Reputation: 14943

th:href="@{/review}"

You need to add root to the path

Edit: What about th:href="@{__${#httpServletRequest.requestURI}__/review}

Upvotes: 1

Related Questions