使用不同URI的控制器操作不起作用

时间:2019-12-18 00:51:51

标签: thymeleaf spring-boot-2

我的视图模型(如<link th:href="@{css/todo/index}" rel="stylesheet" />)中使用的链接标记的href出现问题。 这项功能在example.test/todos之类的控制器操作上效果很好,但在尝试使用仅具有example.test/todo/create之类的URI的同一操作时却无法正常工作。

问题是我没有指向静态文件(css,图像和js)的正确链接href。在第一个动作中,URI是example.test/css/todo/index.css,但是在第二个动作中是example.test/todo/css/todo/create.css

如何解决此问题? 我使用Spring 2.2和百里香

1 个答案:

答案 0 :(得分:1)

我终于解决了问题,首先用/重写了所有链接

相关问题