一,加jar包

加入顺序,个人推荐,spring->struts2->hibernate

    spring的jar包:基本包共21个+用到的aspectj注解的包2个+日志包1个

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    struts2的jar包:基本包共8个+1个(这个包的功能struts2的action交给spring容器管理)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    hibernate的jar包:基本包共10个+c3p0数据源的包+数据库驱动

----至此,所有的jar包都加完了----

二,加配置文件

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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd"> <context:component-scan base-package="convict"></context:component-scan>
<context:property-placeholder location="classpath:db.properties"/> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="initialPoolSize" value="${jdbc.initPoolSize}"></property>
<property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
</bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
</bean> <!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="dataSource" ref="dataSource"></property>
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 启用事务注解 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>

struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<package name="default" namespace="/" extends="struts-default">
<action name="register" class="registerAction">
<result name="success">/welcome.jsp</result>
</action>
</package>
</struts>

hibernate.cfg.xml

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property> <mapping class="convict.po.User"/>
</session-factory>
</hibernate-configuration>

db.properties

jdbc.user=root
jdbc.password=12345678
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql://localhost/db_ssh_comp jdbc.initPoolSize=5
jdbc.maxPoolSize=10

三,加各种包,jsp,action等,如图

四,项目文件太多不一一放上来,有需要可以去下载,https://gitee.com/convicts/ssh_integration_case,点个 star 吖

spring5+Struts2+hibernate5的更多相关文章

  1. 整合Spring5+Struts2.5+Hibernate5+maven

    1. 使用Eclipse创建Maven项目 2. 配置pom.xml引入需要的依赖包 <dependencies> <dependency> <groupId>ju ...

  2. SSH框架搭建步骤总结以及Hibernate二级缓存,查询缓存

    二级缓存.查询缓存 一级缓存: 默认启动,生命周期是和session同步的,session独享 二级缓存: 需要加载配置信息,生命周期是和应用服务器同步,session共享 1:在hibernate. ...

  3. 项目:《ssh框架综合项目开发视频》-视频目录和第六天的EasyUI简单讲解

    4 练习使用技术: Struts2 + hibernate5.x + spring4.x + mysql数据库 1 crm:customer relational manager,客户关系管理 2 c ...

  4. web整合Spring和Hibernate

    上一篇是简单整合web和Spring, 这一篇是整合hibernate: 连接池c3p0: spring5.0, hibernate5.0 jars: ------------------------ ...

  5. 轻量级Java EE企业应用实战:Struts2+Spring5+Hibernate5/JPA2

    轻量级Java EE企业应用实战(第5版)——Struts 2+Spring 5+Hibernate 5/JPA 2整合开发是<轻量级Java EE企业应用实战>的第5版,这一版保持了前几 ...

  6. JavaEE项目开发所需要的包(Struts2+Spring5+Hibernate5)

    在这里我只整理了轻量级JavaEE项目开发所需的包 @Auther MrZhangxd 2019-04-29  23:07:21 链接:https://pan.baidu.com/s/16I4KYah ...

  7. SSH(Struts2+Spring4+HIbernate5)的简化

    今天给大家带来的是一个简单的新闻发布系统 首先在学习过程中我是深有体会,做事情不要浮躁,不要想着一口吃下一个胖子, 最最重要的是理解,理解透了学什么东西都是随心所欲的. 开发环境:win10系统 jd ...

  8. [java web]Idea+maven+spring4+hibernate5+struts2整合过程

    摘要 最近也在网上找了些教程,试着使用maven进行包依赖关系的管理,也尝试着通过注解的方式来整合ssh框架.在这个过程中,踩了不少的坑.折腾很长时间,才算把架子折腾起来.这里把结果整理下,作为以后工 ...

  9. SSH框架的简化(struts2、spring4、hibernate5)

    目的: 通过对ssh框架有了基础性的学习,本文主要是使用注解的方式来简化ssh框架的代码编写. 注意事项: 1.本文提纲:本文通过一个新闻管理系统的实例来简化ssh框架的代码编写,功能包括查询数据库中 ...

随机推荐

  1. Nginx 防爬虫设置

    在conf下  vi 一个文件agent_deny.conf 添加如下内容 #禁止Scrapy|curl等工具的抓取 if ($http_user_agent ~* (Scrapy|Curl|Http ...

  2. Nginx 添加防爬虫

    include agent_deny.conf; conf下添加 #禁止Scrapy|curl等工具的抓取 if ($http_user_agent ~* (Scrapy|Curl|HttpClien ...

  3. 带你自定义实现Spring事件驱动模型

    Spring 事件驱动模型概念 Spring 事件驱动模型就是观察者模式很经典的一个应用,我们可以通过Spring 事件驱动模型来完成代码的解耦. 三角色 Spring 事件驱动模型或者说观察者模式需 ...

  4. Zookeeper绍二(分布式锁介)

    一.为什么会有分布式锁? 在多线程环境下,由于上下文的切换,数据可能出现不一致的情况或者数据被污染,我们需要保证数据安全,所以想到了加锁. 所谓的加锁机制呢,就是当一个线程访问该类的某个数据时,进行保 ...

  5. 联盛德 HLK-W806 (十三): 运行FatFs读写FAT和exFat格式的SD卡/TF卡

    目录 联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明 联盛德 HLK-W806 (二): Win10下的开发环境配置, 编译和烧录说明 联盛德 HLK-W ...

  6. 【Java常用类】BigDecimal

    BigDecimal 一般的Float类和Double类可以用来做科学计算或工程计算,但在商业计算中, 要求数字精度比较高,故用到java.math.BigDecimal类. BigDecimal类支 ...

  7. uboot无法通过nfs加载ubuntu18.04中的文件(转)

    问题描述: i.mx6ull开发板,采用alientek官方维护的uboot,使用ubuntu18.04 lts作为nfs server,导致开发板uboot上nfs命令无法加载网络文件系统. 解决: ...

  8. python2.7发送邮件失败之——SMTPAuthenticationError问题

    使用python2.7发送邮件,代码如下: from email.header import Headerfrom email.mime.text import MIMETextimport smtp ...

  9. 【解决了一个小问题】golang gin框架中的模板,让模板中的参数不要做HTML转义

    代码中使用了类似的方式来向模板填充参数: c.HTML(200, "list.html", gin.H{"data":builder.String()}) 模板 ...

  10. 【小记录】解决链接libcufft_static.a库出现的错误

    程序中使用了 cv::cuda::dft() 函数,需要在链接的时候使用libcufft_static.a这个库.链接出现大量类似错误:error: undefined reference to __ ...