SSM三大框架整合案例

1,首先准备数据库
2,创建动态Web工程
SSM三大框架整合案例
文章图片

3,导入整合Spring+SpringMVC+Mybatis所需的jar包

Spring的核心包 spring-beans-4.0.0.RELEASE.jar spring-context-4.0.0.RELEASE.jar spring-core-4.0.0.RELEASE.jar spring-expression-4.0.0.RELEASE.jar commons-logging-1.1.3.jarSpring的切面包 com.springsource.org.aopalliance-1.0.0.jar com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar spring-aop-4.0.0.RELEASE.jar spring-aspects-4.0.0.RELEASE.jarlog4j日记包 log4j-1.2.17.jarmysql驱动和数据库连接池包 c3p0-0.9.1.2.jar mysql-connector-java-5.1.37-bin.jarSpring的数据库及事务包 spring-jdbc-4.0.0.RELEASE.jar spring-orm-4.0.0.RELEASE.jar spring-tx-4.0.0.RELEASE.jarSpringMVC的包 spring-web-4.0.0.RELEASE.jar spring-webmvc-4.0.0.RELEASE.jarSpring的Hiberante验证包 hibernate-validator-annotation-processor-5.0.0.CR2.jar hibernate-validator-5.0.0.CR2.jar validation-api-1.1.0.CR1.jar jboss-logging-3.1.1.GA.jar classmate-0.8.0.jar文件上传包 commons-fileupload-1.2.1.jar commons-io-1.4.jarSpring中的Json处理包 jackson-annotations-2.1.5.jar jackson-core-2.1.5.jar jackson-databind-2.1.5.jarMyBatis以及整合包 mybatis-3.4.1.jar mybatis-spring-1.3.0.jarJSTL标签库 taglibs-standard-impl-1.2.1.jar taglibs-standard-spec-1.2.1.jar

4,各种配置文件
1,log4j.properties日记配置文件
# Global logging configuration log4j.rootLogger=INFO, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

2,jdbc.properties属性配置文件
jdbc.user=root jdbc.password=root jdbc.url=jdbc:mysql://localhost:3306/ssm jdbc.driver=com.mysql.jdbc.Driver jdbc.initialSize=5 jdbc.maxActive=10

3,Mybatis核心配置文件

4,SpringMVC需要的配置文件
application-mvc.xml配置文件


web.xml中的配置

ssm CharacterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encodingUTF-8 forceEncodingtrue CharacterEncodingFilter /* HiddenHttpMethodFilter org.springframework.web.filter.HiddenHttpMethodFilter HiddenHttpMethodFilter /* contextConfigLocationclasspath:application.xml org.springframework.web.context.ContextLoaderListener springDispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocationclasspath:application-mvc.xml 1 springDispatcherServlet /

5,Spring需要的配置文件 applicationContext.xml
【SSM三大框架整合案例】

    推荐阅读