A brief discussion on the Web development environment setting of Spring+hibernate+sql Server (i.)

Source: Internet
Author: User
Tags java web tomcat server

First, build the development environment

The development environment in this example consists of Eclipse3.2 and MyEclipse, and the following is a simple introduction to the various frameworks and JDBC driver packages that are required in system development to set up in the Eclipse build path.

1. Add Spring Environment

The sample principal framework uses spring to implement the MVC pattern of the Web site. To provide support for the spring framework, you must add the Spring Framework's class library to the build path of Eclipse. The following steps are added:

1.1, right click on the project name, select the "Build Path"/"Add Library" command, in the pop-up "Add Library" dialog box select MyEclipse Libraries list item, click "Next" button.

2.1. In the Add Library dialog box that pops up, select Spring 1.2 AOP librareis, Spring 1.2 Core Libraries, Spring 1.2 orm/dao/hibernate3 Libraries, and Spring 1.2 The Web Libraries check box, and then click the Finish button.

2. Add Hibernate environment

The Hibernate Framework class library is also MyEclipse, and it is added in the same way as spring, but when you select a class library in the Add Library dialog box, Hibernate 3.1 Core Libraries and Hibernate 3.1 should be selected Advanced Support Libraries check box, and then click the Finish button.

3. Adding a JDBC Environment

This example takes the SQL Server 2008 database system, so you need to add the appropriate JDBC driver package in your project. The sample JDBC Driver class inventory is placed in the "F:\EclipseLib\JDBCtoMSSQL" folder. The steps to add the JDBC Driver Class library on this basis are as follows:

3.1. In Eclipse, select the window/Preferences command, and in the Pop-up Preferences dialog, expand the java/build path/user library node item in the left tree, or enter user library directly in the text box in the upper-left corner to activate the settings interface.

3.2. Enter the new class library name in the New User Library dialog box that pops up after you click the New button on the right side of the dialog box

such as: Mssqljdbc, and then click the OK button.

3.3. Back to the original dialog box, select the new MSSQLJDBC user Library, click the Add Jar button on the right, and in the Select Jar dialog box that pops up, choose 3 JDBC Driver packages that connect to the SQL Server 2008 database, and then close the dialog box.

3.4, right click on the project name, select the "Build Path"/"Add Library" command, in the pop-up "Add Library" dialog box select the "User Library" list item, click the "Next" button.

3.5. Select the newly created MSSQLJDBC class library in the Add Library dialog box that pops up, and then click the Finish button.

4. Add a Struts environment

The example uses the title Layout framework, which is included in the Struts class library, so you need to provide support for the Struts framework for your project. The implementation steps are as follows:
4.1. Create a Struts class library in the user library named struts, then add the Struts jar file and place it in the "F:\EclipseLib\jakarta-struts-1.1" folder.

4.2. Right-click the project name, select the build path/Add library command, select the User library list item in the Add Library dialog box that appears, and click the Next button.

4.3. Select the newly created Struts class library in the Add Library dialog box that pops up, and then click the Finish button.

5. Configuring the Tomcat server for MyEclipse

MyEclipse provides a variety of ways to connect Java Web servers, which can be set up to start the Web server directly in eclipse, which makes it easier to control server startup and stop. In addition, all log information for the server will be output to the console of Eclipse, which will be more convenient for debugging the program. The example system running environment is Tomcat 5.5, where the server is connected as an example, the implementation steps are as follows:

5.1. Select the window/Preferences command in Eclipse, expand the Myeclipse/application servers/tomcat 5 node item in the left directory tree in the Pop-up Preferences dialog box, or enter Tomcat directly in the text box in the upper-left corner to activate the settings interface.

5.2. Click the browse button to the right of the Tomcat Home Directory text box in the dialog box and select the location of the Tomcat server installation in the popup dialog box. In the example, Tomcat is installed in the "C:\Tomcat 5.5" folder.

5.3. After you set up the installation location for Tomcat, the contents of the Tomcat Base directory and Tomcat Temp Directory text boxes are set automatically. Select the Enable radio button in the Tomcat Server bar and click the Apply and OK buttons. You can then publish the project to the server through the Publish button in the toolbar. Start and stop the Tomcat server by using the Start/Stop button on the toolbar.

At this point, the site's simple development environment has been completed.

    

A brief discussion on the Web development environment setting of Spring+hibernate+sql Server (i.)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.