首页 > 解决方案 > 本地js文件无法在springboot中加载

问题描述

我写了一个springboot项目,有一个javascript文件位于“src/main/resources/public/swagger/lib/jquery-1.8.0.min.js”

现在我想在我的 html 文件中引入这个 js 文件,它位于“src/main/resources/templates/main.html”

我写<script src='public/swagger/lib/jquery-1.8.0.min.js' type='text/javascript'></script>在html文件中

控制台日志:Failed to load resource: the server responded with a status of 404 () 有什么问题吗?

谢谢!

我认为我的道路没有错,有人可以帮助我吗?

标签: javascriptjqueryspring-boot

解决方案


你应该用 https 和这样的完整链接编写它<script src="http://code.jquery.com/jquery-1.9.1.js"></script>


推荐阅读