SHH架构图
搭建SHH架构
1新建项目
2 sturs2配置
struts2引入jar包、struts2中的路径为struts-2.3.16.1\apps\struts2-blank\WEB-INF\lib
复制粘贴到项目里面
还有struts-2.3.16.1\apps\struts2-json-plugin-2.3.16.1.jar(用于序列化)
还有struts-2.3.16.1\apps\struts2-spring-plugin-2.3.16.1.jar
struts2配置文件
Web.xml配置
过滤器
下面代码复制进去
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
classpath:applicationContext.xml
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2
/*
REQUEST
FORWARD
index.jsp
Struts.xml文件配置
/p>
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
3 spring配置
要引入的 jar包:(从我给的jar里都有)
Spring3.2 开发最基本jar包
spring-beans-3.2.0.RELEASE.jar
spring-context-3.2.0.RELEASE.jar
spring-core-3.2.0.RELEASE.jar
spring-expression-3.2.0.RELEASE.jar
com.springsource.org.apache.commons.logging-1.1.1.jar
com.springsource.org.apache.log4j-1.2.15.jar
AOP开发
spring-aop-3.2.0.RELEASE.jar
spring-aspects-3.2.0.RELEASE.jar
com.springsource.org.aopalliance-1.0.0.jar
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
SpringJdbc开发
spring-jdbc-3.2.0.RELEASE.jar
spring-tx-3.2.0.RELEASE.jar
Spring事务管理
spring-tx-3.2.0.RELEASE.jar
Spring整合其他ORM框架
spring-orm-3.2.0.RELEASE.jar
Spring在web中使用
spring-web-3.2.0.RELEASE.jar
Spring整合Junit测试
spring-test-3.2.0.RELEASE.jar
配置文件
Web.xml
配置监听器(代码在struts2配置时候有了)
将下面两个复制到src中
applicationContext.xml
log4j.properties
如图
4 Hibernate配置
引入jar
hibernate-distribution-3.6.10.Final\hibernate3.jar
hibernate-distribution-3.6.10.Final\lib\required\*.jar
hibernate-distribution-3.6.10.Final\lib\jpa\*.jar
整合的jar包 :slf4j-log4j
数据库驱动:mysql-connector-java-5.0.4-bin.jar
连接池:(c3p0连接池)c3p0-0.9.1.jar
配置文件:
没有hibernate的核心配置文件的方式整合:
配置applicationContext.xml
链接池
事务管理:
配置applicationContext.xml
Hibernate相关信息:
配置applicationContext.xml
org.hibernate.dialect.MySQLDialect
true
true
false
update
以上配置在我给的applicationContext.xml都写好了、咳咳咳= =
——————————简单的搭建——————————
————————————chenchen————————————