在tomcat目录中找到server.xml文件,打开文件并找到<Host >向其中添加
<Context path="" docBase="F:/workplace/p1/WebRoot" debug="0"/>
docBase是项目的绝对路径,如下所示:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="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 "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context docBase="D:\eclipse-jee-neon\apache-tomcat-8.0.37\wtpwebapps\OfficialWebsite" path="" reloadable="true" debug="0"/>
<Context docBase="E:\result" path="/result" reloadable="true"/>
<Context docBase="D:\eclipse-jee-neon\apache-tomcat-8.0.37\wtpwebapps\OfficialWebsite" path="/OfficialWebsite" reloadable="true" source="org.eclipse.jst.j2ee.server:OfficialWebsite"/>
</Host>
重启Tomcat