S2SH+DWR整合

Struts2+Spring+Hibernate搭建全解!

开发环境:MyEclipse6.0+Tomcat5.0+MySQL5.0

配置环境:Struts2+Spring2+Hibernate3.1

个人推荐先配置Spring在hibernate最后Struts2.0

配置Spring2
1)添加Spring2开发架包
spring.jar
struts2-spring-plugin-2.1.6.jar
2)创建Spring配置文件applictionContext.xml,可由IDE工具实现(MyEclipse6
选中项目SSHDemo1,右击
选择菜单“MyEclipse”选项,指向“Project Capabilities”,选择“Add Spring Capabilities”

选择Spring版本为Spring2JAR Libraay Installation项选“Copy...”
点击“Next”

选择创建方式是否创建或覆盖已存在,选中“NEW”,选择applicationContext.xml文件存放路径,点击”Browse”,创建在项目WebRoot/WEB-INF路径下,点击“OK”

点击“Finish”,完成。

如果配置成功,这时我们在看一下项目中的文件就已经存在applicationContext.xml文件。项目下面自动导入了Spring开发支持的包。

applicationContext.xml
代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">


</beans>
下一步配置web.xml文件,添加spring监听器
添加以下代码即可:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
(
注:org.springframework.web.context.ContextLoaderListener路径在Spring.jar包下)

测试发布,Spring2开发环境配置完毕。

配置Hibernate
选择Hibernate版本为Hibernate3.1
JAR Libraay Installation
项选

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值