赛卡特
我有以下Spring Boot项目结构(使用Thymeleaf)-
现在,当我试图引用defect-details.html
从index.html
它不能被发现。我尝试了以下所有选项,但均无济于事:
1。<a th:href="@{/defect-details.html}">
2。<a th:href="@{defect-details.html}">
3。<a href="defect-details.html">
每次都说There was an unexpected error (type=Not Found, status=404)
。
请帮助找到问题。
赛卡特
(正如JBNizet在评论中指出的那样)按照MVC设计架构,最好使用控制器来呈现视图,而不是使用视图对视图链接。我要做的就是使用以下命令更新Controller类:
@RequestMapping("/defect-details")
public String defectDetails() {
return "defect-details";
}
在Thymeleaf模板中:
<a th:href="@{defect-details}">
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
编辑于
我来说两句