Tomcat publishes projects in roughly three ways, but the side dishes think it is best to publish the project by adding a configuration file under Tomcat's Conf/catalina/localhost directory.
Because this is the least invasive of Tomcat, you only need to add a new configuration file, do not have to modify the original configuration, and support dynamic parsing, modify the code directly into effect (except for the modification of the configuration).
But the introduction of this method on the Internet is very simple, side dishes to add.
1. add a server directly to eclipse and add the path to the Tomcat indicated in the process.
2. Create an XML file under the Conf\catalina\localhost directory of the Tomcat server (the path cannot be found and create it yourself), 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, the access path, if you fill it like above, it is necessary to access: http://localhost:8080/TestPro/index.jsp;docBase refers to the project's WebContent (Eclipse) or Webroot (myeclipse) directory, well understood, your project is finally released, that is, the directory is published, through the configuration, direct tomcat to this directory, so 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 will start.
The top is a more common usage, but many times we want to publish the project to the Tomcat root so that you don't have to enter a lengthy publishing path and enter the domain name directly to access it.
To publish a project to the Tomcat root in this way, the following considerations are available:
1. For the sake of insurance, delete the root folder under the WebApps directory in the Tomcat server.
2. set path in XML to null (path= "").
3. change the XML file name to ROOT (Root.xml).
This will allow the project to be published to the Tomcat root directory, which I hope is helpful for everyone.
Tomcat publishes project details through Conf-catalina-localhost Catalog