一,加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. linux(CentOS7) 之 克隆虚拟机并配置网络(固定ip)

    克隆机器 原机关机状态下,克隆. 下一步 选择当前状态,下一步 选择创建完整克隆,下一步 设置虚拟机名称(完成后可以修改).克隆机安装位置,下一步 等待克隆完成 克隆完成 配置网络 添加网卡(因为物理 ...

  2. sqlserver - 查出的结果集,集成为json串放在一个字段里

    1.效果 2.sql SELECT top 20 (select [name] as [名字] from staffBasicInfo For JSON PATH,ROOT('第一级key')) k ...

  3. Centos 7.6关闭selinux

    查看selinux状态 [root@localhost ~]# sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SE ...

  4. 实验 5 :OpenFlow 协议分析和 OpenDaylight 安装

    实验 5 :OpenFlow 协议分析和 OpenDaylight 安装 一.实验目的 回顾 JDK 安装配置,了解 OpenDaylight 控制的安装,以及 Mininet 如何连接: 通过抓包获 ...

  5. Word2010制作饭店活动宣传单

    原文链接: https://www.toutiao.com/i6492754127343321613/ 打开Word文档,选择"页面布局"选项卡."页面背景"功 ...

  6. day 17 i++优先级大于 *i

    (1).有下列定义语句,int *p[4];以下选项中与此语句等价的是[C] (A).int p[4]; (B).int **P; (C).int *(p[4]); (D).int (*p)[4]; ...

  7. java基础04-数据类型扩展及面试题

    java基础04-数据类型扩展及面试题讲解 public class demo02 { public static void main(String[] args){ // 一.整数拓展: 进制 二进 ...

  8. netty系列之:好马配好鞍,为channel选择配套的selector

    目录 简介 netty服务的基本构建方式 EventLoopGroup channel 多种构建方式 其他的channel 总结 简介 我们知道netty的基础是channel和在channel之上的 ...

  9. 【刷题-LeetCode】221. Maximal Square

    Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing ...

  10. 今天太开心了,因为我知道了seastar框架

    今天听说了一个新的C++语言开发的网络框架,叫做seastar. seastar有何特别之处呢?先看看官网提供的性能数据: 性能 HTTPD benchmark: cpu # request/sec ...