body, p, th, td, li, ul, ol, h1, h2, h3, h4, h5, h6, pre
{
font-family: simsun;
line-height: 1.4;
}
body, p, th, td, li, ul, ol, pre
{
font-size: 12px;
}

1. 需要的jar包列表

jar包名称

所在位置

说明

antlr-2.7.6.jar

hibernate/lib/required

解析HQL

aspectjrt

spring/lib/aspectj

AOP

aspectjweaver

..

AOP

cglib-nodep-2.1_3.jar

spring/lib/cglib

代理,二进制增强

common-annotations.jar

spring/lib/j2ee

@Resource

commons-collections-3.1.jar

hibernate/lib/required

集合框架

commons-fileupload-1.2.1.jar

struts/lib

struts

commons-io-1.3.2

struts/lib

struts

commons-logging-1.1.1

单独下载,删除1.0.4(struts/lib)

struts

spring

dom4j-1.6.1.jar

hibernate/required

解析xml

ejb3-persistence

hibernate-annotation/lib

@Entity

freemarker-2.3.13

struts/lib

struts

hibernate3.jar

hibernate

hibernate-annotations

hibernate-annotation/

hibernate-common-annotations

hibernate-annotation/lib

javassist-3.9.0.GA.jar

hiberante/lib/required

hibernate

jta-1.1.jar

..

hibernate transaction

junit4.5

mysql-

ognl-2.6.11.jar

struts/lib

slf4j-api-1.5.8.jar

hibernate/lib/required

hibernate-log

slf4j-nop-1.5.8.jar

hibernate/lib/required

spring.jar

spring/dist

struts2-core-2.1.8.jar

struts/lib

xwork-2.1.2.jar

struts/lib

struts2

commons-dbcp

spring/lib/jarkata-commons

commons-pool.jar

..

struts2-spring-plugin-2.1.8.jar

struts/lib

2. BestPractice:

a) 将这些所有的jar包保存到一个位置,使用的时候直接copy

3. 步骤

a) 加入jar包

b) 首先整合Spring + Hibernate

i. 建立对应的package

1. dao / dao.impl / model / service / service.impl/ test

ii. 建立对应的接口与类框架

1. S2SH_01

iii. 建立spring的配置文件(建议自己保留一份经常使用的配置文件,以后用到的时候直接copy改)

iv. 建立数据库

v. 加入Hibernate注解

1. 在实体类上加相应注解@Entity @Id等

2. 在beans配置文件配置对应的实体类,使之受管

vi. 写dao service的实现

vii. 加入Spring注解

1. 在对应Service及DAO实现中加入@Component,让spring对其初始化

2. 在Service上加入@Transactional或者使用xml方式(此处建议后者,因为更简单)

3. 在DAO中注入sessionFactory

4. 在Service中注入DAO

5. 写DAO与Service的实现

viii. 写测试

c) 整合Struts2

i. 结合点:Struts2的Action由Spring产生

ii. 步骤:

1. 修改web.xml加入 struts的filter

2. 再加入spring的listener,这样的话,webapp一旦启动,spring容器就初始化了

3. 规划struts的action和jsp展现

4. 加入struts.xml

a) 修改配置,由spring替代struts产生Action对象

5. 修改action配置

a) 把类名改为bean对象的名称,这个时候就可以使用首字母小写了

b) @Scope(“prototype”)不要忘记

iii. struts的读常量:

1. struts-default.xml

2. struts-plugin.xml

3. struts.xml

4. struts.properties

5. web.xml

iv. 中文问题:

1. Struts2.1.8已经修正,只需要改i18n.encoding = gbk

2. 使用spring的characterencoding

3. 需要严格注意filter的顺序

4. 需要加到Struts2的filter前面

v. LazyInitializationException

1. OpenSessionInViewFilter

2. 需要严格顺序问题

3. 需要加到struts2的filter前面

Struts2.1.8 + Spring3.0+ Hibernate3.2整合笔记的更多相关文章

  1. MyEclipse-10.0下Struts2.1+Spring3.0+Hibernate3.3整合过程

    新建web project: 命名为SSH,做如下设置: 新建后的工程目录如下: 然后开始添加SSH框架,这里我按照struts-spring-hibernate顺序进行添加. 首先添加struts2 ...

  2. SSH (Struts2+Spring3.0+Hibernate3)框架(二) 框架的配置

    一.准备工作: 1. JDK -> jdk1.6.0_17 安装(环境变量配置): JAVA_HOME = C:\ jdk1.6.0_17; PATH = %JAVA_HOME%\bin; %J ...

  3. SSH (Struts2+Spring3.0+Hibernate3)框架(一) 理论

    典型的J2EE三层结构,分为表现层.中间层(业务逻辑层)和数据服务层.三层体系将业务规则.数据访问及合法性校验等工作放在中间层处理.客户端不直接与数据库交互,而是通过组件与中间层建立连接,再由中间层与 ...

  4. Flex4+Spring3+Hibernate3+BlazeDS整合笔记

    普通Java Web工程流行使用ssh框架,而当前台使用Flex制作的时候,后台就不需要用Struts了,通过使用BlazeDS远程方法调用即可. 首先,新建Java Web工程,然后添加Flex项目 ...

  5. spring3.0+jsf+ibatis整合

    user.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLI ...

  6. Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8整合例子(附完整的请假流程例子,jbpm基础,常见问题解决)

    Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8 整合例子(附完整的请假流程例子). 1.jbpm4.4 测试环境搭建 2.Jbpm4.4+hibernat ...

  7. Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8 整合例子

    转自:http://www.blogjava.net/wangxinsh55/archive/2011/07/24/354925.html   Jbpm4.4+hibernate3.5.4+sprin ...

  8. Maven整合Spring3.0+Mybatis3.2+Struts2.3+查找坐标+jar包依赖(五)

    依赖传递 只添加了一个struts2-core依赖,发现项目中出现了很多jar,这种情况 叫 依赖传递

  9. 开发基础框架:mybatis-3.2.8 +hibernate4.0+spring3.0+struts2.3

    一:项目下载地址(点击 Source code(zip)) https://github.com/fzxblgong/frame_2014-12-15/releases 版本:v1.2大小:20M 二 ...

随机推荐

  1. CodeForces 14 E - Camels &amp;&amp; D - Two Paths

    D - Two paths 仅仅想到了一个o(n^2)的解法. 首先枚举删除一条边,必定得到两棵独立的树.计算两棵树的直径.保留最大乘积. 首先两条路不相交,则必定能够分到两棵子树中,由于要乘积最大, ...

  2. autorun.vbs病毒的清除办法

    症状:计算机里面出现一堆autorun为文件名称的文件,删除后出现找不到autorun.vbs的提示.我就打开当中的一个文件:Autorun.bat,内容例如以下: @echo off  //不显示系 ...

  3. C# - object有哪些基本方法类有

    Name Description Equals(Object) Determines whether the specified object is equal to the current obje ...

  4. 在Mac OS X 10.8中配置Apache+PHP+MySQL

    在Mac OS X 10.8中配置Apache+PHP+MySQL的内容包括: 配置Apache 配置PHP 安装MySQL 配置PHPAdmin 设置数据库默认字符集 一. 配置Apache 1. ...

  5. ios 安装OpenFire

    1.开发xmpp官网下载 2.打开openfire.pkg 3.点击继续 4.成功安装后打开偏好设置 ->双击poenfire->弹出窗体[好] 5.随后会弹出以下这个视图 开启 strr ...

  6. java设计模式之四建造者模式(Builder)

    工厂类模式提供的是创建单个类的模式,而建造者模式则是将各种产品集中起来进行管理,用来创建复合对象,所谓复合对象就是指某个类具有不同的属性,其实建造者模式就是前面抽象工厂模式和最后的Test结合起来得到 ...

  7. protobuf-net-data

    protobuf-net http://www.codeproject.com/Articles/642677/Protobuf-net-the-unofficial-manual https://g ...

  8. shell 批量压缩指定文件夹及子文件夹内图片

    shell 批量压缩指定文件夹及子文件夹内图片 用户上传的图片,一般都没有经过压缩,造成空间浪费.因此须要编写一个程序,查找文件夹及子文件夹的图片文件(jpg,gif,png),将大于某值的图片进行压 ...

  9. SQL点滴7—使用SQL Server的attach功能出现错误及解决方法

    原文:SQL点滴7-使用SQL Server的attach功能出现错误及解决方法 今天用SQL Server 2008的attach功能附加一个数据库,出了点问题,提示的错误是: Unable to ...

  10. Javascript实战开发:教你使用raphael.js绘制中国地图

    最近的数据统计项目中要用到中国地图,也就是在地图上动态的显示某个时间段某个省份地区的统计数据,我们不需要flash,仅仅依靠raphael.js以及SVG图像就可以完成地图的交互操作.在本文中,我给大 ...