applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"><!-- 配置@Service包扫描 相当于配置了该包下所有类的<bean>--><context:component-scan base-package="com.heima.service" /><!-- 加载配置文件 --><context:property-placeholder location="classpath:jdbc.properties" /><!-- 数据库连接池 --><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close"><property name="driverClassName" value="${jdbc.driverClass}" /><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.userName}" /><property name="password" value="${jdbc.password}" /><!-- 连接池的最大数据库连接数 --><property name="maxActive" value="10" /><!-- 最大空闲数 --><property name="maxIdle" value="5" /></bean><!-- SqlSessionFactory配置 --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource" /><!-- 加载mybatis核心配置文件 --><property name="configLocation" value="classpath:SqlMapConfig.xml" /><!-- 配置别名 --><property name="typeAliasesPackage" value="com.heima.pojo" /></bean><!-- 动态代理,第二种方式:包扫描(推荐): --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.heima.dao"></property></bean>
</beans>

SqlMapConfig.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
</configuration>

jdbc.properties

jdbc.driverClass = oracle.jdbc.driver.OracleDriver
jdbc.url = jdbc:oracle:thin:@172.18.9.24:1521:ORCL
jdbc.userName = scott
jdbc.password =tiger

springmvc.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:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"><!-- 配置controller扫描包 --><context:component-scan base-package="com.heima.controll" /><!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/><bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" /> --><!-- 配置注解驱动,相当于同时使用最新处理器映射跟处理器适配器,对json数据响应提供支持 --><mvc:annotation-driven></mvc:annotation-driven><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"><!-- 配置视图响应的前缀 --><property name="prefix" value="WEB-INF/jsp/" /><!-- 配置视图响应的后缀 --><property name="suffix" value=".jsp" /></bean></beans>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"><display-name>SpringMvc01</display-name><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><!-- web项目中需要这么配置,否则会报错,带注解的类Spring不能实例化 --><!-- 配置spring --><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext*.xml</param-value></context-param><!-- 使用监听器加载Spring配置文件 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><servlet><servlet-name>dispatcherServlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><!-- 加载springmvc核心配置文件 --><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:springmvc.xml</param-value></init-param></servlet><servlet-mapping><servlet-name>dispatcherServlet</servlet-name><url-pattern>*.action</url-pattern></servlet-mapping>
</web-app>

post请求的乱码解决,需要在web.xml添加过滤器

     <!-- 解决post乱码问题 --><filter><filter-name>encoding</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><!-- 设置编码参是UTF8 --><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>encoding</filter-name><url-pattern>/*</url-pattern></filter-mapping>

Dao层

service层

controll层

记第一次ssm整合的配置文件相关推荐

  1. SSM整合时配置文件的编写

    编写web.xml 1.配置项目初始化时启动Spring容器 传递参数,spring配置文件的位置 <context-param><param-name>contextConf ...

  2. SSM整合(配置文件)

    Web.XML <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="htt ...

  3. ssm整合开发配置文件

    配置的具体解释可以参考米米商城项目实战 ssm框架部分 pom.xml <?xml version="1.0" encoding="UTF-8"?> ...

  4. SSM整合shiro权限框架

    一.SSM整合shiro框架 1.步骤 1.添加shiro框架需要的jar包,包括shiro-core.shiro-web.shiro-spring的关系依赖 <!-- shiro jar包依赖 ...

  5. SSM 整合开发初见面

    SpringMVC是Spring其中的一个模块,我们直接使用即可: SSM的整合:将Mybatis 和 Spring进行整合: >类的根路径:classpath,也就是classes文件夹 sr ...

  6. SSM框架学习文档以及SSM整合(附Github地址=含SSM学习时的实例代码)

    SSM框架学习 软件架构: 基于流行SSM框架:Spring+SpringMVC+Mybatis 项目配置: 使用Maven进行项目jar导入 ​ 使用Git进行版本控制,并将每次编写的代码上传到Gi ...

  7. 超十万字_超详细SSM整合实践_手动实现权限管理

    SSM整合_基础配置 SSM框架中包含Spring,SpringMVC,Mybatis.而Spring与SpringMVC都是Spring Framework的模块,无需整合.只需将Mybatis与S ...

  8. SSM整合:原始方式

    01:SSM整合:原始方式 02:SSM整合:Spring整合Mybatis 文章目录 1. 原始方式 1.1 准备工作 1.1 导入相关的Maven依赖 1.2 编写实体类 1.3 编写Mapper ...

  9. SSM项目小例子,SSM整合图文详细教程

    SSM项目小例子 今天来搭建一个SSM项目的小例子简单练一练,那项目模板还是我们那个模板,就是我们在JavaWeb最后的小例子,那到SSM中我们如何实现,后面我们再看看springboot中如何实现 ...

最新文章

  1. C指针8:二级指针(意思就是指向指针的指针)
  2. ckeditor4.4.6添加代码高亮
  3. 作为谷歌开发者布道师,我为什么要写这本通俗的《数据压缩入门》(一)
  4. 【leetcode】987. Vertical Order Traversal of a Binary Tree
  5. XamarinEssentials教程清空键值
  6. css学习笔记3--灵活的背景定位
  7. ubuntu安装openssl命令
  8. r语言和python的区别_机器学习怎样开始比较好?Python还是R语言?
  9. 数仓是如何与“夏令时”愉快的玩耍?
  10. TensorFlow的基本运算03
  11. JAVA Reflection(反射机制)
  12. sunplus8202V双无线游戏手柄设计
  13. 【Matlab身份证识别】BP神经网络身份证号码识别【含源码 1344期】
  14. 前端项目:基于Nodejs+vue开发实现酒店管理系统
  15. 【唐老狮】Unity和UE4两大游戏引擎,你该如何选择?
  16. 甘肃人社生物识别认证系统服务器,甘肃人社生物识别认证系统
  17. 【软件测试之项目实战】
  18. 陀螺仪随机误差的Allan方差分析
  19. 物理五大信道浅聊PRACH、PUCCH、PUSCH、PDCCH、PDSCH
  20. 【技术人快报】摩拜单车多地区现Bug+iCloud完成中国本土化落地

热门文章

  1. pod库报C++头文件file not found问题
  2. 怎么保证方舟服务器的稳定,方舟确保加入服务器运行最新怎么解决mod | 手游网游页游攻略大全...
  3. V8 JavaScript引擎
  4. 104、前端5种安全问题及防范
  5. [SIGIR‘22]图对比推荐论文SimGCL/XSimGCL算法和代码简介
  6. 如何手动关闭elementUI的popover
  7. python3.6---读取图片,处理图片,新建图片
  8. 2014-梦工厂回忆录
  9. Oracle的grid及ASM
  10. InvalidateRect函数