解决问题(Failed to load resource the server responded with a status of 404 (Not Found))
【解决问题(Failed to load resource the server responded with a status of 404 (Not Found))】CSS和JS链接出错:Failed to load resource: the server responded with a status of 404 (Not Found)。
CSS文件如下:
<
linkhref="http://www.srcmini.com/Jquery/jquery.multiselect.css" rel="stylesheet"/>
<
linkhref="http://www.srcmini.com/Jquery/style.css" rel="stylesheet" />
<
linkhref="http://www.srcmini.com/Jquery/prettify.css" rel="stylesheet" />
JS文件如下:
<
scriptsrc="http://www.srcmini.com/Jquery/jquery.multiselect.js"><
/script>
<
scriptsrc="http://www.srcmini.com/Jquery/prettify.js"><
/script>
CSS和JS链接出错,报错信息如下:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/jquery.multiselect.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/style.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/prettify.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/jquery.multiselect.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/prettify.js
解决办法:
1、如果HTML文件或JSP文件等和JS、CSS不在同一个文件,例如JSP文件夹和JS/CSS的文件夹同等,也就是说它们有相同的父文件夹,那么只需使用如下设置即可:
<
scriptsrc="http://www.srcmini.com/Jquery/prettify.js"><
/script>
2、其它情况,可能HTML/JSP和JS/CSS文件夹不是同等的,那就需要做其他设置。以上的出错是因为路径的问题,“../“是”包含目录“或”向上一个目录“的简写,这是一个相对URL。除了使用上面的解决办法,你也可以在Web项目中直接使用绝对路径,该方式比较安全,路径从你的项目名开始如下:
<
link href="http://www.srcmini.com/你的Web项目名/Jquery/jquery.multiselect.css" rel="stylesheet"/>
推荐阅读
- wordpress个人博客主题BuddyPress最新中文版在线社区系统社交网站免费下载
- 解决Vue错误([Vue warn] Error in render RangeError Invalid array length)
- 解决Vue问题([Vue warn] Avoid mutating a prop…Prop being mutated list (found in component ))
- 解决Vue问题(Uncaught ReferenceError Vue is not defined)
- 解决vue-cli安装错误(npm ERR! A complete log of this run can be found in npm ERR!)
- 前端CSS(实现CSS集合)
- PHP date_default_timezone_set()函数用法详解
- 算法设计(在按行排序的矩阵中找到中位数)
- PHP atanh()函数用法介绍