javascript - 本地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 ()
有什么问题吗?
谢谢!
我认为我的道路没有错,有人可以帮助我吗?
解决方案
你应该用 https 和这样的完整链接编写它<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
推荐阅读
- sql-insert - SQL - 我如何插入这些表?
- macos - 使用 productbuild 创建带有 pdf 许可证的安装程序包
- oracle - 在 Power BI 中将一个表拆分为多个表
- java - Webview 无法在现有代码上运行打印 Oreo 下方的错误
- android - 通过套接字发送包含曲目编号、标题、艺术家、专辑、流派和持续时间的歌曲列表?
- inno-setup - 在 Inno Setup 中以随机数作为参数执行程序?
- sql - SQL Server 中的魔术表和临时(系统版本)表之间的区别?
- scala - 如何在带有循环的spark中创建一个when表达式
- php - 如何限制输入字段中的空格?
- java - 从另一个文件夹导入包