文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > Spring3.0+struts2+Hibernate3.5 整合操作
侵权投诉

Spring3.0+struts2+Hibernate3.5 整合操作

Spring3.0+struts2+Hibernate3.5 整合操作

Spring + struts + hibernate 整合操作: 搭建开发环境

1 配置文件

4 个配置文件

struts.xml

beans.xml

xxx.hbm.xml

web.xml

2 jar

注意jar包冲突

struts2-spring-plugin.jar(必需)

----------------------------------------------------------------- Spring + Struts2整合

1 开发 Service 在spring配置文件中进行配置

2 Struts2开发步骤

1) 在web.xml 配置单控制器

2) 开发Action

a implements Action execute

b Spring配置文件 注入Service

<bean id="regAction" class="com.ssh.RegAction" scope="prototype"> 每次都创建一个新的对象

<property name="userService">

<ref local="userService"/>

</property>

</bean>

c struts.xml 配置

<action name="reg" class="regAction">

<result name="success"></result>

</action>

3 创建Spring工厂

ApplicationContext ctx = new ClassPathXmlApplicationContext ("/day6/transaction2/beans.xml");

web.xml 配置使用

org.springframework.web.context.ContextLoaderListener <context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/classes/beans.xml</param-value>

</context-param>

第1页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email