eclipse下快速整合struts1+spring+hibernate

eclipse下快速整合struts1+spring+hibernate

ID:14017722

大小:522.50 KB

页数:10页

时间:2018-07-25

eclipse下快速整合struts1+spring+hibernate_第1页
eclipse下快速整合struts1+spring+hibernate_第2页
eclipse下快速整合struts1+spring+hibernate_第3页
eclipse下快速整合struts1+spring+hibernate_第4页
eclipse下快速整合struts1+spring+hibernate_第5页
资源描述:

《eclipse下快速整合struts1+spring+hibernate》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、快速整合struts+spring+hibernate——FromBinGo快速整合struts+spring+hibernate操作平台:Eclipse3.2、MyEclipse5.1.1GA三个框架在MyEclipse下添加顺序为:Struts、Spring、Hibernate首先新建一个WebProject。1.添加Struts进去:Myeclipse——>AddStrutsCapabilities:设置好包路径后继续;2.添加Spring。选择MyEclipse菜单下的AddSpringCapabilities…,JARLibraryInstallation位置选

2、择“Copy”项,下一步,设置SpringBean配置文件位置,我们选择工程的WEB-INF目录10快速整合struts+spring+hibernate——FromBinGo,点击完成,就添加了Spring。1.继续,切换到MyEclipseDatabaseExplorer(数据库浏览器视图),添加一个数据连接。测试连接成功后继续,这一步是为了给下面添加Hibernate框架准备的,因为它在建立过程中需要指定一个有效连接数据库的连接;2.添加Hibernate。选择MyEclipse菜单下的AddHibernateCapabilities…选择所有的标签库,包括Spri

3、ng的。JARLibraryInstallation位置还是选择“Copy”项,10快速整合struts+spring+hibernate——FromBinGo下一步,因为之前添加了Spring框架,所以这里就会自动识别到,并询问你使用Hibernate的配置文件“hibernate.cfg.xml”还是使用Spring的配置文件“applicationContext.xml”,这里选择Spring来统一配置,下一步;此处是定义Spring配置文件是需要新建还是使用已存在的Spring配置文件,这里选择ExistingSpringconfigurationfile,即使用

4、已存在的Spring配置文件“WebRoot/WEB-INF/applicationContext.xml”10快速整合struts+spring+hibernate——FromBinGo,下方需要指定Hibernate的SessionFactory在Spring配置文件中的BeanID,使用“sessionFactory”即可,下一步;在DBProfile的下拉列表中选择刚刚建立的连接,并在BeanID处设置这个DataSource在Spring配置文件中的BeanID名,这里使用“datasource”,下一步;10快速整合struts+spring+hibernat

5、e——FromBinGo接下来的DefineSessionFactoryproperties界面是配置Hibernate的SessionFactory工具类存放位置,不用选择即可,点击Finish,就完成了对Struts、Spring、Hibernate三个框架的设置。这里还需要配置Log4J(日志工具),只需将以下两个文件复制到SRC目录下即可commons-loggingproperties.propertieslog4j.properties至于这两文件里的具体配置就不再多说。1.把Spring集成到Struts。需要在Struts-config.xml文件里添加以

6、下字段:Value值就指定了Spring配置文件applicationContext.xml文件具体包位置。2.再就是为数据表添加持久化类。过程是在MyEclipseDataBaseExplorer中打开连接,找到所需的表后,鼠

7、标右键点击表名,选择“HibernateReverseEngineering…”,10快速整合struts+spring+hibernate——FromBinGo设置了包路径后,依次钩选“HibernateMappingFile”、“JavaDataObject”(取消钩选“Createabstractclass”)以及“JavaDataAccessObject(DAO)”,在“JavaDataAccessObject(DAO)”下会自动钩选“Generateprecisefindbymethods”,以及选择“SpringD

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。