在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 "%r" %s %b" />
<Context path="/myapp" reloadable="true" docBase="D:\myappWeb" workDir="D:\myappWeb\work"/>
</Host>
在host中添加context,path指定上下文路径,docBase指定文件路径,workDir是缓存文件的路径。我在d:\myappweb下面放置了一个helloword.jsp文件,启动后,访问地址