struts2+hibernate+spring注解版框架搭建以及简单测试(方便脑补)

Posted --->别先生<---

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了struts2+hibernate+spring注解版框架搭建以及简单测试(方便脑补)相关的知识,希望对你有一定的参考价值。

为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补;

1:File--->New--->Other--->Maven--->Maven Project--->Next(之后界面如下所示:)

--->Next(点击next之后出现如下界面:选择最后一个 maven-archetype-webapp,然后点击next)

--->Next(点击next之后出现如下界面,然后选择好组织号,工程号,版本号即可),最后点击Finish

2:maven项目创建好之后会报错,这里先在pom.xml中导入jar包,导入方式如下所示:这个pom配置好之后点击保存会将jar包下载到本地仓库,这个学习maven的时候都配置过,这个自己下去脑补吧;注意第304行struts2注解配置;

  1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3   <modelVersion>4.0.0</modelVersion>
  4   <groupId>com.bie.maven</groupId>
  5   <artifactId>ssh_annotation</artifactId>
  6   <packaging>war</packaging>
  7   <version>0.0.1-SNAPSHOT</version>
  8   <name>ssh_annotation Maven Webapp</name>
  9   <url>http://maven.apache.org</url>
 10   
 11   
 12   
 13    <!-- 配置一下jar包 -->
 14    <properties>
 15         <java-version>1.8</java-version>
 16         <junit-version>4.8.2</junit-version>
 17         <org.springframework-version>3.2.4.RELEASE</org.springframework-version>
 18         <jackson-mapper-asl-version>1.9.12</jackson-mapper-asl-version>
 19         <jackson-core-asl-version>1.9.12</jackson-core-asl-version>
 20         <mysql-connector-java-version>5.1.8</mysql-connector-java-version>
 21         
 22         <!-- 
 23         <org.mybatis-version>3.2.7</org.mybatis-version>
 24         <org.mybatis-spring-version>1.2.2</org.mybatis-spring-version>
 25         -->
 26         
 27         <opensymphony-version>2.4.2</opensymphony-version>
 28         <freemarker-version>2.3.9</freemarker-version>
 29         <c3p0-version>0.9.1.2</c3p0-version>
 30         <commons-collections-version>1.0</commons-collections-version>
 31         <commons-fileupload-version>1.2.2</commons-fileupload-version>
 32         <org.apache.commons-version>3.1</org.apache.commons-version>
 33         <commons-codec-version>1.6</commons-codec-version>
 34         <dom4j-version>1.6.1</dom4j-version>
 35         <javax.servlet-version>1.2</javax.servlet-version>
 36         <aspectjweaver-version>1.6.6</aspectjweaver-version>
 37         <slf4j-log4j12-version>1.6.6</slf4j-log4j12-version>
 38         <log4j-version>1.2.16</log4j-version>
 39         <javax.servlet-jsp-version>2.0</javax.servlet-jsp-version>
 40         <cglib-version>2.2.2</cglib-version>
 41         <slf4j-api-version>1.6.6</slf4j-api-version>
 42         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 43     </properties>
 44     <dependencies>
 45         <!-- 配置 junit4.8.2 -->
 46         <dependency>
 47             <groupId>junit</groupId>
 48             <artifactId>junit</artifactId>
 49             <version>${junit-version}</version>
 50             <type>jar</type>
 51         </dependency>
 52         <!-- 配置 spring -->
 53         <dependency>
 54             <groupId>org.springframework</groupId>
 55             <artifactId>spring-core</artifactId>
 56             <version>${org.springframework-version}</version>
 57         </dependency>
 58         <dependency>
 59             <groupId>org.springframework</groupId>
 60             <artifactId>spring-web</artifactId>
 61             <version>${org.springframework-version}</version>
 62         </dependency>
 63         <dependency>
 64             <groupId>org.springframework</groupId>
 65             <artifactId>spring-test</artifactId>
 66             <version>${org.springframework-version}</version>
 67         </dependency>
 68         <dependency>
 69             <groupId>org.springframework</groupId>
 70             <artifactId>spring-aspects</artifactId>
 71             <version>${org.springframework-version}</version>
 72         </dependency>
 73         <dependency>
 74             <groupId>org.springframework</groupId>
 75             <artifactId>spring-context-support</artifactId>
 76             <version>${org.springframework-version}</version>
 77         </dependency>
 78         <dependency>
 79             <groupId>org.springframework</groupId>
 80             <artifactId>spring-web</artifactId>
 81             <version>${org.springframework-version}</version>
 82         </dependency>
 83 
 84         <dependency>
 85             <groupId>org.springframework</groupId>
 86             <artifactId>spring-webmvc</artifactId>
 87             <version>${org.springframework-version}</version>
 88         </dependency>
 89         <dependency>
 90             <groupId>org.springframework</groupId>
 91             <artifactId>spring-jdbc</artifactId>
 92             <version>${org.springframework-version}</version>
 93         </dependency>
 94         <dependency>
 95             <groupId>org.springframework</groupId>
 96             <artifactId>spring-tx</artifactId>
 97             <version>${org.springframework-version}</version>
 98         </dependency>
 99         <dependency>
100             <groupId>org.springframework</groupId>
101             <artifactId>spring-instrument</artifactId>
102             <version>${org.springframework-version}</version>
103         </dependency>
104         <dependency>
105             <groupId>org.springframework</groupId>
106             <artifactId>spring-instrument-tomcat</artifactId>
107             <version>${org.springframework-version}</version>
108         </dependency>
109         
110         <dependency>  
111             <groupId>org.springframework</groupId>  
112             <artifactId>spring-orm</artifactId>  
113             <version>${org.springframework-version}</version>  
114         </dependency>
115         <!--springmvc 转换为 Json -->
116         <dependency>
117             <groupId>org.codehaus.jackson</groupId>
118             <artifactId>jackson-mapper-asl</artifactId>
119             <version>${jackson-mapper-asl-version}</version>
120         </dependency>
121         <dependency>
122             <groupId>org.codehaus.jackson</groupId>
123             <artifactId>jackson-core-asl</artifactId>
124             <version>${jackson-core-asl-version}</version>
125         </dependency>
126         <!--配置 freemarker -->
127         <dependency>
128             <groupId>freemarker</groupId>
129             <artifactId>freemarker</artifactId>
130             <version>${freemarker-version}</version>
131         </dependency>
132         <!-- 配置 mybatis-spring ssh这里可以不配置mybatis-->
133         <!--
134         <dependency>
135             <groupId>org.mybatis</groupId>
136             <artifactId>mybatis</artifactId>
137             <version>${org.mybatis-version}</version>
138         </dependency>
139         <dependency>
140             <groupId>org.mybatis</groupId>
141             <artifactId>mybatis-spring</artifactId>
142             <version>${org.mybatis-spring-version}</version>
143         </dependency>
144         -->
145         
146         <!-- jdbc driver -->
147         <dependency>
148             <groupId>mysql</groupId>
149             <artifactId>mysql-connector-java</artifactId>
150             <version>${mysql-connector-java-version}</version>
151         </dependency>
152         <!-- connect pool with c3p0 -->
153         <dependency>
154             <groupId>c3p0</groupId>
155             <artifactId>c3p0</artifactId>
156             <version>${c3p0-version}</version>
157         </dependency>
158         <!-- apache commons jar -->
159         <!-- <dependency>
160             <groupId>commons-collections</groupId>
161             <artifactId>commons-collections</artifactId>
162             <version>${commons-collections-version}</version>
163             <scope>provided</scope>
164         </dependency> -->
165 
166         <dependency>
167             <groupId>commons-fileupload</groupId>
168             <artifactId>commons-fileupload</artifactId>
169             <version>${commons-fileupload-version}</version>
170         </dependency>
171 
172         <dependency>
173             <groupId>org.apache.commons</groupId>
174             <artifactId>commons-lang3</artifactId>
175             <version>${org.apache.commons-version}</version>
176         </dependency>
177 
178         <dependency>
179             <groupId>commons-codec</groupId>
180             <artifactId>commons-codec</artifactId>
181             <version>${commons-codec-version}</version>
182         </dependency>
183         <!-- analyze xml use dom4j -->
184         <dependency>
185             <groupId>dom4j</groupId>
186             <artifactId>dom4j</artifactId>
187             <version>${dom4j-version}</version>
188         </dependency>
189         <!-- about servlet -->
190         <dependency>
191             <groupId>javax.servlet</groupId>
192             <artifactId>jstl</artifactId>
193             <version>${javax.servlet-version}</version>
194         </dependency>
195 
196 
197         <dependency>
198             <groupId>taglibs</groupId>
199             <artifactId>standard</artifactId>
200             <version>1.1.2</version>
201         </dependency>
202         <dependency>
203             <groupId>javax.servlet</groupId>
204             <artifactId>javax.servlet-api</artifactId>
205             <version>3.0.1</version>
206             <scope>provided</scope>
207         </dependency>
208         <dependency>
209             <groupId>org.slf4j</groupId>
210             <artifactId>slf4j-log4j12</artifactId>
211             <version>1.6.6</version>
212             <scope>provided</scope>
213         </dependency>
214         <dependency>
215             <groupId>log4j</groupId>
spring 学习之三(spring 与hibernate, struts2整合)

Struts2 + Spring + Hibernate 分页

Struts2+Spring+Hibernate(SSH)框架的搭建

struts2集成Spring,Hibernate的问题!!

Spring:Spring整合Hibernate,之后整合Struts2

Maven搭建Struts2+Spring3+Hibernate4框架