Search code examples
javahtmlspringthymeleafhref

href with parameter not calling controller


I would like to achieve super basic functionality where I click on something and will be returned with more details of this entry - precisely I click on movie title and would like to call a @controller that will bring more details of this movie. Currently this is never calling my controller :

@GetMapping("/film/{title}")

<td><a href="/film/film.title" th:text="${film.title}">Film</a>

Solution

  • With little you provide on your question, this should give you what you need.

    <a th:href="|/film/+${film.title}|" th:text="${film.title}">