请问老司机们. 在课的最后 js 请求的问题上.为啥控制台显示的 js 请求路径有问题?不是配置
<mvc:default-servlet-handler/>之后 , 静态资源会走服务器默认的 servlet 么?
导入 js 资源出现两种下面两种情况:
<script src="/resource/script/seckill.js" type="text/javascript"></script>
http://localhost:8080/resource/script/seckill.js
Failed to load resource: the server responded with a status of 404 (Not Found)
<script src="resource/script/seckill.js" type="text/javascript"></script>
http://localhost:8080/seckill/seckill/1001/resource/script/seckill.js
Failed to load resource: the server responded with a status of 404 (Not Found)
谢谢大神帮忙解答~
首先要保证你的web根目录是webapp,这个在project structure里面设置。
然后在webapp文件夹下面有resources和WEB-INF两个平级的目录,注意平级。
<script src="/seckill/resource/script/seckill.js" type="text/javascript"></script>
试试
遇到同样的问题,网上说配置mvc:resource mapping:.........location......根本没有效果