Tomact配置虚拟路径 访问图片
方法一:
<Context docBase="F:\image" path="/image" />
<Context docBase="F:\video" path="/video" />
在tomact的server.xml中:
在<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
下边写上
<Context path="/imageService" docBase="F:\image" reloadable="true" />
方法二:
(1)假设图片保存路径为 F:\file\image
(2)eclipse下配置访问本地图片:
双击tomcat server打开tomcat配置页面:
(3)点击modules,点击Add External Web Module,配置如图
(4)jsp页面img标签填写为<img src="/image/test.jpg"/>即可访问保存在本地 F:\file\image下文件名为test.jpg的图片