How to create Dynamic Web project projects
The demonstration in this article is to create Dynamic Web project from a local file, similar to creating Dynamic Web project from SVN checkout. We recommend using the tomcat6.x version of the decompression version as the server. can be downloaded to http://tomcat.apache.org. Before creating a Dynamic Web project, let's create a server to run and debug the Web project in Eclipse.
Create a server
The server was created to make it easier to start and debug Dynamic Web project in Eclipse, and to create a server that uses Tomcat, for example, basically follow a step-by-step approach:
- Create a new server project
- We select Tomcat6 and link to our Tomcat directory
- When you're done, you'll see a window like the one below, and if you can't see it, you can open the view as shown in the second picture.
- Such a server is well-equipped. Click the Green Run button to run your tomcat using the configuration under Server.
Create a Dynamic Web project
The Dynamic Web project of Eclipse itself is similar to MyEclipse Web project, and if you create Dynamic Web project in MyEclipse, you need to check show all when creating a new project. Wizards:
- Similar to creating other projects, or from File->new->other->web->dynamic Web project,
- Fill in the relevant information for the project. In this interface there is a project contents, the mode is under your workspace, you can also choose any other location, or the existing file. I am accustomed to putting project files in separate folders.
Note here that if you are using MyEclipse Web project, the value of content directory defaults to Webroot and you need to change to webcontent because our scripts are written in WebContent.
When you click OK, the following warning box may pop up asking if you want to switch to the Java EE view associated with the project type. The so-called simple view is the combination of view.
- Project creation This is done, in the left side of the project bar will appear the following (the specific display and you are in what view is related, the diagram is navigator under the display form)
- You can also modify the relevant configuration of the project according to your habits, I am accustomed to the Java files compiled into webcontentweb-infclasses, this you can click on the Source tab, modify the default output folder content. Also note in Apache Tomcat v6.0 This is a bunch of jar packages that are introduced by the server, while Web App libraries refers to all the jar packages under Webcontent/lib under your project when you are in webcontent/ When adding a new jar under LIB, you don't need to add jars yourself.
- You can run the project in Eclipse by right-clicking on the project root and then run as and selecting run on server.
Breakpoint Debugging
After you have created server and dynamic Web project, debug your Java code as long as you choose Debug as when you run the project, and in another way, Remote Java project.
This way, we need to write a script to Tomcat.
Debug.bat
View Source1SET Catalina_opts=-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket, Server=y,suspend=n,address=58882call startup.bat Tips
As follows, will continue to supplement:
- When your project is large and you want to start Tomcat in eclipse, it often fails because of a timeout, when you can double-click a server in the servers view, and the contents of the upper part can be extended in timeouts.