Idea + maven 搭建 SSH (struts2 +hibernate5 + spring5) 环境

《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》点击传送门,即可获取!

org.apache.struts

struts2-core

2.3.35

org.apache.struts

struts2-spring-plugin

2.3.35

org.apache.struts

struts2-json-plugin

2.3.8

1.4 配置Java EE 坐标依赖

这里可以引入 servlet api,jstl 标签库等一系列工具

javax.servlet

javax.servlet-api

3.1.0

provided

javax.servlet.jsp

javax.servlet.jsp-api

2.3.1

provided

org.projectlombok

lombok

1.18.0

provided

jstl

jstl

1.2

taglibs

standard

1.1.2

1.5 其他工具

json 处理工具

org.jetbrains

annotations-java5

RELEASE

compile

org.json

json

20160810

二、项目结构搭建

=======================================================================

2.1 配置文件

使用如下方式创建

在这里插入图片描述

  1. applicationContext.xml

  2. jdbc.properties

  3. struts.xml

2.2 包结构

创建如下的基本包结构

在这里插入图片描述

三、编写配置文件

=======================================================================

3.1 web.xml 文件配置

Archetype Created Web Application

contextConfigLocation

classpath:applicationContext.xml

struts2

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

struts2

/*

org.springframework.web.context.ContextLoaderListener

3.2 编写 jdbc.properties 文件

这里我们需要自己手动修改数据库的信息配置

jdbc.driverClass=com.mysql.jdbc.Driver

jdbc.jdbcUrl=jdbc:mysql://localhost:3306/hibernate?characterEncoding=utf-8&autoReconnect=true&useSSL=false

jdbc.user=root

jdbc.password=root

#连接池中保留的最小连接数

jdbc.minPoolSize=1

#连接池中保留的最大连接数

jdbc.maxPoolSize=20

#初始化连接数

jdbc.initialPoolSize=1

3.3 编写 applicationContext.xml 配置文件

这里面也

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值