1. 程式人生 > >Tomcat下的專案訪問本地檔案

Tomcat下的專案訪問本地檔案

 

在tomcat中 server.xml檔案中 

    <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">下面加入

    <Context debug="0" docBase="E:\edu_upload\" path="/file" reloadable="true"/> 這一行 

docBase 你本地檔案地址  path 訪問是對映地址 

 

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Context debug="0" docBase="E:\edu_upload\" path="/file" reloadable="true"/>
        <!-- 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 &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>


      </Host>