关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()]
分类:
文章
•
2024-08-29 10:58:34
问题截图如下
![关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()] 关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()]](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzMzMy9iOWRiYzZhN2E4OGU3ODkwMjI5NDkzMDI3YmNiNzRjNS5wbmc=)
显示效果如下
![关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()] 关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()]](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzc4NS9kMmZiODBhYmE3NDkzN2RiNzljNTE2ZmJhODk0MThlMS5wbmc=)
解决方法
tomcat8及以后都是utf8编码 (这是tomcat的)所以不用改,但是你的开发环境idea不是呀所以要设置idea的vm环境和tomcat编译的环境【-Dfile.encoding=UTF-8】
![关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()] 关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()]](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzM0MS8yNmJlNjQ2ODc2YTJlMThjODhiNjAxMDc2MjgwYTFiNS5wbmc=)
![关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()] 关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()]](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzM1OC82Y2VjMTk1MWEyMDQ3NTBjYzhhYTZhZDU3MWUzMzc1ZS5wbmc=)
如果更改之后,js效果显示不了,但是没有报错,清除一下浏览器的缓存即可
* 有时浏览器读到的东西是你上一次的东西,新的东西并没有真正更新发布过来,这是就要清除一下缓存。比如在idea中换了张图片 tomcate也重新运行了,但是页面刷新就是还是原来那张图,这种情况经常遇见但是都知道是缓存原因所以清下缓存就搞定了
![关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()] 关于idea中web项目添加js文件,路径资源错误的问题[Failed to load resource: the server responded with a status of 404 ()]](/default/index/img?u=aHR0cHM6Ly9waWFuc2hlbi5jb20vaW1hZ2VzLzc1NS8wNDNkMjc0MGM5YmE5ZmIzOWNjNzY5YWFlNGQyMTUwMy5wbmc=)