Blog has now migrated to: http://henderyblog.sinaapp.com Welcome to visit
When you use MyEclipse and Tomcat for Java Web Development, you need to deploy the project to a Tomcat server. There are usually three ways to do this:
The first: (recommended) Direct deployment in Tomcat, open the Conf folder under the Tomcat installation directory, locate the Server.xml file (this file is a Tomcat server profile), find </Host> Position (typically in the fourth line of the file). Add the following statement before the </Host> symbol:
<context path= "/name" docbase= "Project Location" reloadable= "true"/>
The name here is the name of the folder where you want to deploy the file, equivalent to the root folder in the WebApps folder in Tomcat. Project location refers to your project location, where you need to find the WebRoot folder under the project, in the form of "D;\ project name \webroot".
After the configuration is complete, you can enter in the browsing period: localhost:8080/name/index.jsp Run your project (note that the name here is name in the configuration above).
With this deployment, you just have to configure it once at the beginning of the project, with good stability, and this way is irrelevant to the IDE, and is recommended for general use.
The second: (not recommended) in the MyEclipse deployment, the specific process is as follows:
Select Tomcat 6.x Deploy type is the way to deploy, the first is the expanded directory approach, and the second is in the form of a compressed package. Selecting the first method generates a folder with the same name as the project under Tomcat's WebApps folder, and the second option generates a. War compressed file that is the same as the project name under the WebApps folder. The difference between the two approaches is that the second way when Tomcat is enabled is to extract the compressed file into a file with the same name, in the final analysis and the first way. In this case, you can access the Web program by entering the same URL as the first way in the Browse. This approach, although relatively convenient, but will appear after modifying the file, need to repeat the configuration problem. In addition, this approach relies on the IDE and is not universal, so it is not recommended.
Third: It is also done with MyEclipse, copying the Webroot folder of the project directly in MyEclipse, and then pasting it into the Tomcat WebApps folder, renaming it (named in one of the same naming methods, optionally named). Then you can access your Web application by browsing through the name of the folder you named Localhost:8080/name/index.jsp. This approach is actually a variant of the second way. The
three ways have advantages and disadvantages and can be selected as needed.