SSM整合:
1、创建 maven项目,选择webapp的模板
2、引入相关的依赖
spring springmvc spring事务 mybatis mybatis-spring mysql驱动
servlet jsp jackson druid
SSM整合步骤
在数据库中创建一个要操作的表。
IDEA中使用maven创建一个web项目。
在pom.xml文件中添加相关依赖。
(spring、spring事务、springmvc、mybatis、mybatis-spring、mysql驱动、servlet、jsp、jackson、druid等)
在web.xml文件中声明容器对象
1)声明spring的监听器 ContextLoaderListener:创建spring容器对象(service、dao)。
2)声明springmvc的中央调度器 DispatcherServlet:创建springmvc容器对象(controller)。
3)声明字符集过滤器 CharacterEncodingFilter,解决post请求乱码的问题。
编写mybatis配置文件、spring配置文件、springmvc配置文件。
编写Java代码:实体类、dao接口和对应的mapper文件、service类、controller类。
配置 tomcat 相关配置,启动测试。
