masterdany88
masterdany88

Reputation: 5331

thymeleaf generate REST url with dynamic parameters/elements

I would like to create REST url with thymeleaf. I've something like this:

<a th:href="@{customer/(${c.id})/edit}">Edit</a>

The output is: http://localhost:8080/app/customer/($%7Bs.id%7D)/edit

But I would like to get: http://localhost:8080/app/customer/4/edit

How can I achive this? please help.

Upvotes: 2

Views: 1492

Answers (1)

Jaiwo99
Jaiwo99

Reputation: 10017

What you need called Preprocessing, just follow the link!

In your case, you should do it like this:

<a th:href="@{customer/__${c.id}__/edit}">Edit</a>

Upvotes: 4

Related Questions