1. Context primarily describes Eclipse's process of creating a Tomcat access path
Key XML: Tags: Context (context) Properties: dobase (absolute path) path (access path)
2.-dcatalina.base= "E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0"
: The path to the private information for each Tomcat directory, which is conf, Logs,webapps,work, TEMP
-dcatalina.home= "E:\work_resource\apache-tomcat-7.0.56": Install directory, point to the location of public information
-dwtp.deploy= "E:\workspace": Working space
-djava.endorsed.dirs= "E:\work_resource\apache-tomcat-7.0.56\endorsed": classes that can be used to overwrite the JDK itself, where loading is preferred
First, create a new Hello project in Eclipse, where the workspace is in C:/eclipse/workspace, so the location of the Hello project is in the%workspace%/hello/folder.
Then add a hello.jsp or index.jsp to the Hello Project (index.jsp will be handy), the content to write casually, such as in the body tag between a Hello Eclipse and tomcat6.0!. Then select "Run on Server" in Run as, which will invoke the already configured Tomcat server (turn your Tomcat service off, let Eclipse invoke it, or there will be a small conflict) when in the browser (the Web in Eclipse Browser) There is something we want to see, where url=http://localhost/hello/(implied index.jsp)!
Hello Eclipse and tomcat6.0!
! The point is, what did eclipse do during this period? Tomcat in the virtual directory, you do not set Hello, how can run?
1. In MyEclipse's practice (MyEclipse, the method that eclipse does not have) is: Copy your project to the webapps/directory in the Tomcat directory (this directory, without settings, Tomcat will use the folder as a site, But webapps/the HTML file in this directory is not resolved, root directory url/parsing is the root folder of the Web page file, so Tomcat has a more site, naturally accessible.
2. Unlike in Eclipse, Eclipse invokes JAVAw.exe in the JDK and specifies a number of parameters, such as:
%java_home%/bin/javaw.exe-dcatalina.base=c:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/ TMP1 "-dcatalina.home=c:/tomcat 6.0"-dwtp.deploy=c:/eclipse/workspace/.metadata/.plugins/ Org.eclipse.wst.server.core/tmp1/wtpwebapps "-djava ......."
If your Windows Task Manager has an impression path (or other Task management tool) you will see this line of command, and at this point the task list does not Tomcat.exe the service process, but you can access the Tomcat server's Hello project page.
At this point, open the folder: C:/ECLIPSE/WORKSPACE/.METADATA/.PLUGINS/ORG.ECLIPSE.WST.SERVER.CORE/TMP1
You can see a structure similar to the Tomcat directory, with all of your engineering copies in Wtpwebapps (that is, project in the workspace directory). If you visit http://localhost you may be prompted to 404 can't find the page, but there is a file in root under your Tomcat, and now you can't use the site under Tomcat's WebApps, because Eclipse changed (using parameters, Temporarily change, turn off the Tomcat service in Eclipse, Tomcat reverts to the original Tomcat WebApp home directory (I think it's-dcatalina.base= ...). )
The following use%tmp1% instead of C:/ECLIPSE/WORKSPACE/.METADATA/.PLUGINS/ORG.ECLIPSE.WST.SERVER.CORE/TMP1;
Open%tmp1%/conf/server. xml with Notepad (like the structure under the Tomcat folder), this is the file that configures the virtual directory, we can find the host tag, no different (here appbase is still webapps, but it has been mapped to the% Tmp1%/wtpwebapps), in fact, these files should be copied from the Tomcat conf folder here, and then modified according to Eclipse project, we see.
In the following there are two context of the virtual directory entries; Yes, three. The first one specifies the root (nothing in this file, so I can't access http://localhost/), and the project doesn't matter, the second and third is my Hello and HelloWorld project, see, have docbase and relative URL of path. So you can access the JSP pages of Hello and HelloWorld in the browser.
<context docbase= "C:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/root" Path= "" reloadable= "false"/>
<context docbase= "c:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ HelloWorld "path="/helloworld "reloadable=" true "source=" Org.eclipse.jst.jee.server:HelloWorld "/>
<context docbase= "C:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/hello" Path= "/hello" reloadable= "true" source= "Org.eclipse.jst.jee.server:hello"/>
Reference: http://blog.csdn.net/xys_777/article/details/6594755
Eclipse's mapping to tomcat access