*******************************************************
Author: Chen Gang, an ordinary programmer, had the privilege of developing a medium-sized software in the form of Eclipse plugins. will now Learn
Put on paper, tentatively take the title <eclipse Plugin Development Guide, will be published in early 2005 by Tsinghua University Press.
blog:http://blog.csdn.net/glchengang/
*******************************************************
Chapter 9th Development of the Java EE in Eclipse
Eclipse default installation is no Java EE Development Support, it needs to install third-party plug-ins, this chapter of the main introduction of the Java EE Development plug-in is Lomboz, the main development environment is Tomcat + Lomboz + Struts + Hibernate, which is currently a popular choice. Where Tomcat acts as a Web server; Lomboz is a tool developed by the Java EE; Struts provides powerful MVC schema support; Hibernate replaces the cumbersome EJB to act as a persistent layer of the database.
All of these tools and packages are popular, powerful, and free, and are typical of the Java EE development. This chapter will be divided into three levels to expand the interpretation of the progressive:
Development of Pure Java Lomboz under L
L-Java development with struts
L-EE development after combining struts and hibernate
Due to space limitations, this chapter focuses on the installation and configuration of the development environment, supplemented by a typical and deep example to demonstrate specific development operations, and finally gives a data index to expand the knowledge.
This chapter and the 8th chapter also use CVS to manage all routines, and the version number of this section is shown in parentheses after each section's title. The specific environment for this chapter is: windowsxp + jdk1.4.2_06 + eclipse3.1m4 + cvsnt2.0.58d + Tomcat5.0.28 + Lomboz3.1.0 + Struts 1.2.4. 9.1 Web Environment Building (V0010) 9.1.1 Download CVS version considerations
Because of the V0010 version, there are some empty directories that are required, or the project will be faulted. This requires modifying a CVS configuration, as shown in Figure 9.1, opening eclipse preferences → Group →cvs→ to uncheck the "Trim empty directory" item.
Figure 9.1 Modifying the CVS configuration 9.1.2 tomcat download and installation
This section first builds the Tomcat environment, Tomcat's download installation and Eclipse, Lomboz are not directly related, it is completely independent.
1. Download Tomcat
(1) Open the Tomcat download page with IE: http://jakarta.apache.org/tomcat/index.html, select the link "Binaries" to the left of the page and go to the page shown in Figure 9.2 below:
Figure 9.2 Tomcat Project selection
(3) Click on the "Tomcat" item identified in the image above and the page shown in Figure 9.3 below appears
Figure 9.3 The specific download
(4) Download the "5.0.28.exe" item shown in Figure 9.3 above, the downloaded file name is: Jakarta-tomcat-5.0.28.exe
L Note:
L (1) do not download tomcat5.5.* version, because it needs JDK5.0 support, do not download 4.1.* version, it is too weak. Because the installation and configuration between the different versions will vary, be sure to download version 5.0.28 in order to synchronize with this tutorial.
L (2) if the multi-threaded download tool such as FlashGet cannot be downloaded, use the "Save As ..." item in the original IE right-click menu to download.
2. Install Tomcat
The process of installing Tomcat is simple, double-clicking the resulting download file: Jakarta-tomcat-5.0.28.exe, start the installation.
(1) Select the installation component. Accept the default check box, as shown in Figure 9.4 below.
Figure 9.4 Selecting components
(2) Select the Tomcat installation directory. Also accept the default values, which will be installed into the C:/Program Files/apache software foundation/tomcat 5.0 directory, as shown in Figure 9.5 below:
Figure 9.5 Tomcat's installation directory
(3) Select the HTTP listening port, as shown in Figure 9.6 below. The default port is 8080, and if the 8080 port is already occupied by other software on your PC (such as IIS, JBoss, and so on), you can choose another free port. Finally, the Super Admin admin of Tomcat is set to a password (this book is set to 123456).
Figure 9.6 Setting up ports and passwords
(4) Set the JVM used by Tomcat, the default value of this book is "C:/Program files/java/j2re1.4.2_06", as shown in Figure 9.7 below. A lot of data points out that when installing the JDK to set the settings classpath, Java_home, path and other environment variables, but this book from the beginning of the first chapter has not set these environment variables, the same can run unobstructed, perhaps the new version of the jdk1.4.2_06 is a good solution to these problems. As you can see from this step, Tomcat has positioned the JVM at the time of installation, eliminating the need to manually set it up.
Once the JVM is set up, click the Install button to start the installation.
Figure 9.7 Locating the JVM location
(5) After the installation is complete, in the Windows Control Panel → administrative tools → services window, you can see that Tomcat is already registered as a service for Windows, as shown in Figure 9.8 below. Make sure it's a "manual" approach, which is important at development time because we want to start Tomcat later through Eclipse.
Figure 9.8 Windows Services window
3. Start Tomcat
Although it is later developed to start Tomcat through Eclipse, it is now time to start Tomcat in order to test whether Tomcat is successfully installed.
(1) can be via Windows Start menu → "Apache Tomcat5.0" group → "Configure Tomcat" Word runs Tomcat's configuration interface (as shown in Figure 9.10 below), which contains some of tomcat's parameter settings, which are generally not changed. A direct "click" button launches Tomcat.
Figure 9.10 Tomcat's configuration Interface
(2) Enter "http://localhost:8080" or "http://127.0.0.1:8080" in IE, where 8080 is the port number set at the time of installation. If the launch succeeds, the page shown in Figure 9.11 will appear, whereas if this page does not appear, the startup is unsuccessful, and you need to check that the previous installation steps are consistent with the book.
Figure 9.11 Verifying that Tomcat is installed and started successfully
Note: There are two links on the left side of the previous Figure page: Tomcat administration, Tomcat manager, which are used to manage Tomcat, and the login password is the username admin and password 123456 that you set when you installed Tomcat. Where Tomcat Adiministration can set the database connection pool, manage users and permissions, and other Tomcat server related settings; Tomcat manager entries are primarily used to publish Web page management. It makes it easy to publish a war package to Tomcat.
For a solution to the Tomcat Chinese issue, see section 9.4.6. download and installation of 9.1.3 Lomboz
When downloading Lomboz, be sure to select the appropriate Lomboz version for the version of Eclipse, otherwise the corresponding version will likely cause Lomboz to not work properly. This chapter is still using CVS, so use the ECLIPSE3.1M4 version, Lomboz Select the corresponding version 3.1.0.
1. Download Lomboz
Lomboz Download Address is: http://forge.objectweb.org/project/showfiles.php?group_id=97, download page as shown in Figure 9.12, please select for eclipse3.1.x lomboz to download, and also need to download EMF packages (as shown in the arrows in the illustration).
The file name after download is:
L Org.objectweb.lomboz_3.1.0.n20050106.zip
L Emf-sdo-runtime-i200412160800.zip
Figure 9.12 Lomboz's download page
2, Installation Lomboz
(1) Because Lomboz, EMF is the Eclipse plug-in, so it and other Eclipse plug-in installation method, the book uses the links-style plug-in installation method, the specific steps are no longer repeated, see section 1.2 installation steps.
Figure 9.13 Below is the directory structure after the installation is complete:
Figure 9.13 Installation directory structure of Lomboz and EMF
Where the links directory in Figure 9.13 has the newly created two text files:
L file Lomboz.link, content only one sentence: path=lomboz_3.1.0.n20050106
L file Emf.link, content also only one sentence: path=emf-sdo-runtime-i200412160800
(2) Verify that the Lomboz is installed successfully
Start Eclipse. If the installation is successful, select file → new → project to see the Lomboz project shown in Figure 9.14 below.
Figure 9.14