1. Configure the development environment for Eclipse, configure the JDK installation path and the Tomcat installation path.
2. Create a Dynamic Web Project Project Zhgy under Eclipse, when you use the new Tomcat in eclipse to launch the Dynamic Web project by launching the Tomcat, The project is not actually published to the WebApps of the Tomcat installation directory. This can be viewed in the WebApps directory of the Tomcat installation directory described above. From the console output at startup time, the project is published to the following directory:
Info: Set Web App root system property: ' webapp.root ' = [D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 \wtpwebapps\zhgy\]
Open this directory to see clearly that there is a folder such as Zhgy, this is the project directory we can now access.
Then open D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\ This directory, you can see the structure of this directory and D:\Tomcat 6.0 directory structure is identical, Just a few more Wtpwebapps directories. In fact D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\ This directory is the eclipse of the D:\Tomcat 6.0 directory of a clone, so that D:\ The workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\ is also capable of having source server capabilities.
3. If the new server, the D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\ directory will appear in sequence temp0, Temp1, TEMP2 and other clone servers, But there is only one clone server that can be started at a time, because they all use the same boot port (and, of course, the same shutdown port, etc.).
This will bring us a lot of inconvenience. For example: As far as the above project is concerned, when we are in the process of development, the project needs to put the uploaded images into the upload folder of the project's sibling directory, it will find that the image is uploaded to the directory D:\workSpace\.metadata\.plugins\ Org.eclipse.wst.server.core\tmp0\wtpwebapps\upload\, but the uploaded picture cannot be accessed in the browser. At this point we can manually copy the upload directory to the D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\, In this case, it is really accessible in the browser. This behavior is caused by the fact that the Tomcat server defaults to WebApps as the project directory, not the Wtpwebapps directory. The D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\zhgy\ can be accessed through the browser through the Zhgy project, is due to the fact that Eclipse released the project through Tomcat in D:\workSpace-jx\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\conf The Server.xml file in the directory has the following settings:
[HTML]View PlainCopy
- <Context docbase="D:\workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\ Zhgy "
- Path="/zhgy" reloadable="true" source="org.eclipse.jst.jee.server:zhgy"/>
This can be understood by looking at the new Tomcat property in Eclipse, as shown in server locations:
Manual copying can solve the problem, but it is inconvenient. However, the server locations in is gray and cannot be changed. In fact, Eclipse new Tomcat clone can be changed, but in the new Tomcat do not add any project in, and then click on Tomcat right button open:
Explain the deployment path issue (. metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps) for the Tomcat project under Eclipse