tomcat查找文件路径

在server.xml文件中

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="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"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Context path="/myapp" reloadable="true" docBase="D:\myappWeb" workDir="D:\myappWeb\work"/>


      </Host>

在host中添加context,path指定上下文路径,docBase指定文件路径,workDir是缓存文件的路径。我在d:\myappweb下面放置了一个helloword.jsp文件,启动后,访问地址

http://127.0.0.1:8080/myapp/HelloWorld.jsp

你可能感兴趣的:(tomcat查找文件路径)