在html页面通过绝对地址显示图片
1.编辑tomcat中conf目录下的server.xml文件,在<Host></Host>中添加如下代码段
<Context path="/D" docBase="D:\" reloadable="true"></Context> <Context path="/C" docBase="C:\" reloadable="true"></Context> <Context path="/E" docBase="E:\" reloadable="true"></Context> <Context path="/F" docBase="F:\" reloadable="true"></Context>
2.修改原来的绝对地址
原先:
$(".footImage img:first").attr("src","D:/Workspaces/MyEclipse%202017%20CI/.metadata/.me_tcat85/webapps/onlineshoppingmall/bookimage/1.jpg");
修改后:
$(".footImage img:first").attr("src","/D/Workspaces/MyEclipse 2017 CI/.metadata/.me_tcat85/webapps/onlineshoppingmall/bookimage/1.jpg");