【SSM项目案例】数据库增删改查-完整代码

一、搭建环境

1)spring环境搭建

2)spring整合springmvc框架

目的:在controller中能成功调用service对象的方法

在项目启动时,加载applicationContext.xml的配置文件,在web.xml中进行配置

在controller中注入service对象,调用service对象的方法进行调试

3)spring整合mybatis框架

搭建和测试mybatis的环境

在web项目中编写mybatis-cofig.xml的主配置文件

目的:把mybatis-config.xml配置文件中内容全部配置到applicationContext.xml配置文件中,同时把mybatis配置文件的内容清除掉。

注意:由于我们使用的是代理dao的模式,dao具体实现是有mybatis使用代理方式创建,所以此时mybatis配置文件不能删

二、创建数据库和表

1、users用户表

创建表

 插入数据

2、emp职员表

创建表

猜你喜欢

转载自blog.csdn.net/xjj1128/article/details/128209563