Example: Project name--SPRINGMVC,
Physical Path--d:\study\workspaces\springmvc,
Destination URL Access Form--http://localhost:8080/smvc/... ;
Note: The following deployment methods are based on the tomcat default configuration, and if there are customizations, you need to make adjustments accordingly.
Mode one: Copy the item to the WebApps directory; (MyEclipse how the deployment works)
Action: Under WebApps, create a new folder named Smvc, copy "Web application content" into the Smvc folder and start Tomcat;
Description: The name of the folder is access to the root path, such as the folder named Smvc2,url is http://localhost:8080/smvc2/... ;
"Web application Content" refers to all files under the standard Web application root directory, if the IDE is eclipse, the content defaults to WebContent
Directory of all files, if it is MyEclipse, the default is the Webroot directory of all files, attention class file;
The deployment configurations below are matched by the eclipse's default settings.
Mode two: Modify the Server.xml file; (the way in which eclipse creates a new server deployment, which can also be configured by a Tomcat plug-in deployment)
Action: Add the following configuration to the host tag:
XML code
<context path= "/smvc" docbase= "D:\STUDY\Workspaces\SpringMVC\WebContent"/>
Note: The parameters configured here are required, and can be added reloadable, workdir and other parameters, the same below;
Dobase is said to be able to press WebApps with the relative path, never tried.
Mode three: Add an XML configuration file in the Conf\catalina\localhost directory; (this method can be configured by a Tomcat plug-in deployment)
Action: Create a new name for the Smvc.xml file with the following contents configured:
XML code
<context docbase= "D:\STUDY\Workspaces\SpringMVC\WebContent"/>
Description: Catalina\localhost directory tomcat download is not the default, the first start will be automatically created, can also be manually created;
The path attribute is removed from the configuration because it is not available, and the root path when accessing the project depends only on the name of the XML file;
If there is no webcontent directory, and the content is placed directly under the project root, the XML file is supposed to be named ". Xml", if
The operating system is not allowed, but it can be done with a Tomcat plug-in, which is more magical.
A third approach is recommended because you do not need to modify the tomcat default configuration, and if you want to Undeploy, delete the XML configuration file directly;
These three ways personal feeling is more common, but Tomcat After 5.5 independent out of the context.xml, and the official no longer advocated to modify the Server.xml, that is, the way in this article two, has tried to do in context.xml only deployment configuration, but did not succeed, online check, a lot of mention configuration context.xml are configured data source and so on, the official website did not find How to use the Context.xml file to deploy the project, so I haven't figured out how to use context.xml, and how to deploy the Web project, to focus on this issue.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/