如果js文件里面引用图片 image/xx/xx 这样也会默认带上springmvc 类上的路径(info),也就是info/image/xx/xx
js 里引用图片用绝对路径是这样的
var curWwwPath=window.document.location.href;
var pathName=window.document.location.pathname;
var pos=curWwwPath.indexOf(pathName);
var localhostPaht=curWwwPath.substring(0,pos); //域名
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); //项目名称
原地址为:http://localhost:8080/project
改后地址:http://localhost:8080
用绝对路径 就要把js文件里面每一个引用的图片去掉projectName。
不用绝对路径的他会自动加上info。郁闷啊