Failed to load resource: the server responded with a status of 404 (Not Found)

今天在中ssm项目的时候遇到一个404错误:

Failed to load resource: the server responded with a status of 404 (Not Found)_第1张图片

简单描述就是,在sublime中在html中将界面写出来,然后在导入到jsp中,发现link和script中的链接不能够正常引入:

Failed to load resource: the server responded with a status of 404 (Not Found)_第2张图片Failed to load resource: the server responded with a status of 404 (Not Found)_第3张图片

刚开始在网上找答案,感觉基本上就是说要使用绝对路径,后来我试了一下发现确实是只能绝对路径才能找到,那如果是这样的话,以后发布到网上的话会不会找不到绝对路径。

所以我想到单独将css和js文件等这些需要引入的文件直接放入到tomcat服务器中,然后在通过服务器进行绝对路径使用,这样项目相对于服务器是运用了相对路径:

Failed to load resource: the server responded with a status of 404 (Not Found)_第4张图片

Failed to load resource: the server responded with a status of 404 (Not Found)_第5张图片

Failed to load resource: the server responded with a status of 404 (Not Found)_第6张图片

Failed to load resource: the server responded with a status of 404 (Not Found)_第7张图片

最后问题解决了,哈哈哈哈!

Failed to load resource: the server responded with a status of 404 (Not Found)_第8张图片

接下来还有一个解决办法:

Failed to load resource: the server responded with a status of 404 (Not Found)

你可能感兴趣的:(开发问题)