Tomcat publishes the project in roughly three ways, but the side dishes think it is best to publish the project by adding a configuration file under the Tomcat's Conf/catalina/localhost directory.
Because this is the least intrusive for Tomcat, you just need to add a configuration file, do not need to modify the original configuration, and support dynamic resolution, modify the code to take effect directly (except to modify the configuration).
But the online introduction of this method is very simple, the side dishes to add.
1. add a server directly to eclipse, and add a path that indicates tomcat in the process.
2. Create an XML file under the Conf\catalina\localhost directory of the Tomcat server (the path cannot be found to create itself), as follows:
<context path= "/testpro" docbase= "D:\javaProject\TestPro\WebContent" debug= "0" privileged= "true" >
</Context>
where path refers to the project's publishing path, that is, access path, if like the above fill, it is necessary to visit: http://localhost:8080/TestPro/index.jsp;docBase Refers to the project's WebContent (Eclipse) or Webroot (myeclipse) directory, and it is well understood that your project is finally released, that is, the directory that is published, and by configuration, direct tomcat to the directory, so that you can run the project.
Note: XML the file name must be consistent with the publishing path. In this example, the XML file name must be: Testpro
3. start Tomcat in Eclipse and the project starts.
The above is a more common usage, but many times we want to publish the project to the Tomcat root directory so that we can access it without entering a lengthy publishing path.
In this way, the project is published in the Tomcat root directory, the following considerations:
1. For insurance purposes, delete the root folder in the WebApps directory in the Tomcat server.
2. set the path in XML to Empty (path= "").
3. change the XML file name to ROOT (Root.xml).
This allows you to publish your project to the Tomcat root directory, and hopefully this article will help.