Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot Thymeleaf Could not parse as expression with an url

I'm putting a button on page 1 to navigate to page 2. Page 1 and 2 are on different controllers.

This is the code of my button. The pid is the ID of the project. p.id gives the ID of the project. But I don't know what the problem here is.

<td><a th:href="@{/projects/project/{pid}/clusters(pid=${p.id})" class="btn btn-info" role="button">Clusters</a></td>

The exception:

org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "@{/projects/project/{pid}/clusters(pid=${p.id})" (projects:53)
like image 834
Urban Avatar asked Sep 12 '25 18:09

Urban


1 Answers

You've missed one curly bracket at the end of expression

<a th:href="@{/projects/project/{pid}/clusters(pid=${p.id})}" class="btn btn-info" role="button">Clusters</a>
like image 93
Mykola Yashchenko Avatar answered Sep 15 '25 16:09

Mykola Yashchenko