th:href="@{路径}"路径问题记录


测试路径

http://127.0.0.1:8080/admin/blogs/input

出错点

th:href="@{lib/editormd/css/editormd.min.css}"

问题

测试时候没有找到该文件

th:href路径问题

分析

文件实际路径
th:href路径问题
打开控制台发现实际请求路径为
th:href路径问题

解决方法

修改th:href的路径为
th:href="@{/lib/editormd/css/editormd.min.css}"
在lib前加’/

测试
th:href路径问题

收获

该路径如果开头加’/'为该项目的根目录,lib和static目录下的lib同一级别,此时根路径为http://127.0.0.1:8080
否则以URL请求路径为根目录,lib和input同一级别,此时根路径为http://127.0.0.1:8080/admin/blogs

特此记录

相关文章:

  • 2021-06-29
  • 2022-02-21
  • 2021-10-31
  • 2021-06-26
  • 2021-09-28
  • 2021-07-13
  • 2021-07-10
  • 2021-06-03
猜你喜欢
  • 2022-03-07
  • 2021-12-11
  • 2021-12-24
  • 2021-09-14
  • 2021-06-18
  • 2021-10-16
相关资源
相似解决方案