tomcat7默认的程序发布路径为tomcat/webapps/ROOT/下面
修改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 "%r" %s %b" /> </Host>
name为本地访问地址、appBase为项目的父地址,均可以修改。在host标签之间加入如下标签
<Context path="" docBase="example" debug="0" reloadable="true" />
此刻example目录和ROOT目录的作用是一样了