<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Context path="/FoodStore-Images" docBase="D:Program FilesApache Software FoundationTomcat 7.0webappsFoodStoreFoodStore-Images" ></Context>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
</Host>
再tomcat的confserver.xml的host标签下加上 <Context path="/FoodStore-Images" docBase="D:Program FilesApache Software FoundationTomcat 7.0webappsFoodStoreFoodStore-Images" ></Context>代码,即可用http://ip地址:端口号/FoodStore-Images/文件名.后缀名 来访问"D:Program FilesApache Software FoundationTomcat 7.0webappsFoodStoreFoodStore-Images"路径下的文件资源。