js等靜態(tài)資源請求問題
請問老司機們. ?在課的最后 js 請求的問題上.為啥控制臺顯示的 js 請求路徑有問題?不是配置
<mvc:default-servlet-handler/>之后 , 靜態(tài)資源會走服務(wù)器默認的 servlet 么?
導(dǎo)入 js 資源出現(xiàn)兩種下面兩種情況:
<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)
謝謝大神幫忙解答~
2018-05-30
首先要保證你的web根目錄是webapp,這個在project structure里面設(shè)置。
然后在webapp文件夾下面有resources和WEB-INF兩個平級的目錄,注意平級。
2016-09-22
<script src="/seckill/resource/script/seckill.js" type="text/javascript"></script>
試試
2016-08-29
遇到同樣的問題,網(wǎng)上說配置mvc:resource mapping:.........location......根本沒有效果