Search code examples
thymeleafspring-boot-2

Controller action with different URI doesn't work


I have a problem with href of link tag used in my view model like <link th:href="@{css/todo/index}" rel="stylesheet" />. This work nice on a controller action like example.test/todos but doesn't work when I try with a same action that just have a different URI like example.test/todo/create.

The problem is I don't have right links href to static files (css ; images ; and js). In the first action URI is example.test/css/todo/index.css but is example.test/todo/css/todo/create.css on the second action.

How to fix this ? I using spring 2.2 and thymeleaf


Solution

  • I have finally fix my problem by rewriting all links with a / first