Note: This tutorial uses the database: Mysqldatabase: oa database creation statement: createdatabaseoadefaultcharactersetutf8 designated ide development tool: MyEclipse Project name: New web project, name: OA, and set the project code: the main technical framework used in the UTF-8 environment: JU
Note: This tutorial uses the "create database oa default character set utf8" command to specify the ide development tool: MyEclipse Project name: create a new web project named OA and set the project code: the main technical framework used in the UTF-8 environment: JU
First Note: This tutorial is for Chuanzhi podcast Tang Yangguang.
A specified database: Mysql
Database: oa
Database creation statement: create database oa default character set utf8
2. Specify the ide development tool: MyEclipse
Project name: Create a new web project, name: OA, and set the project code: UTF-8
Main technical frameworks used in the environment: JUnit4, Struts2.3.15.1, Hibernate3.6, Spring2.5.6, jQuery ,......
3. Add a framework environment:
1. Add the JUnit environment:
Right-click the project name --> Build Path --> Add Libraries --> JUnit, click next, select JUnit 4, and click finish. Add the JUnit environment.
2. Add the Struts2.3.15.1 environment:
Add a jar package:
In advance to the official website to download the corresponding version of the project environment, unzip the open into the apps folder, use a good tool to open the struts2-blank.war, click the WEB-INF,
Copy all the jar packages under lib to the lib of our OA project.
Add a configuration file:
Use a good pressure tool to open the struts2-blank.war, click the WEB-INF, src --> java below the struts. xml copy to our OA project src below. Then
Modify the content in struts. xml to the following:
1
25 6
7 8
9
10
11
12
13
14 15
16 17
18 19
20 21
If the xml Code does not prompt, find in the project package we downloaded, Location: struts-2.3.15.1/src/core/src/main/resources/struts-2.3.dtd.
Configure it to myeclipse.
Use a good pressure tool to open the struts2-blank.war, click the WEB-INF, copy the following content in web. xml to our web. xml:
1
2 3
struts2
4 5
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
6 7
8 9 10 11
12 13
struts2
14 15
/*
16 17
3. Add the hibernate3.6 environment:
Add a jar package:
1) Add the core package: hibernate3.jar
2) under the lib folder in the project package: All jar packages in required, all jar packages in the jpa folder, and c3p0 packages in the optional folder.
3) mysql driver package.
Add a configuration file:
1) Add hibernate. cfg. xml. The specific template content is as follows (after the project environment is added, modify it again ):
14 5
6
7
8
True
9 10
Update
11
12
Org. hibernate. dialect. MySQL5Dialect
13
14
15
Com. mysql. jdbc. Driver
16
Jdbc: mysql: // oa
17
Root
18
Root
19
21
22
2) Add the XX. hbm. xml template with the following content (ADD and modify the code during development ):
1
2 5 6
7 8
4. Add the Spring2.5.6 development environment:
Add a jar package:
1) core package:
Spring. jar
2) Dependency package:
All jar packages under spring2.5.6/lib/aspectj
Jar packages under spring2.5.6/lib/cglib
Spring2.5.6/lib/jakarta-commons/commons-logging.jar (not required if added)
Add the configuration file applicationConxt. xml. The template content is as follows (the specific content is improved during ssh integration ):
1
2
5
12 13
14
15 16 17