上一页 1 2 3 4 5 6 7 ··· 9 下一页
摘要: 使用import导入时,属性使用resource,而不是import 所以选 D2. 如果在MyBatis-CongigLocation.xml逐个列出所有的sql映射文件,比较繁琐,可以利用SqlSessionFactoryBean的mapperLocations属性扫描式加载SQL映射文件,可以 阅读全文
posted @ 2019-11-15 17:25 听风忆雪 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 案例 导入架包 <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans --> <dependency> <groupId>org.springframework</groupId> <artifactId>s 阅读全文
posted @ 2019-11-14 16:25 听风忆雪 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 什么是拦截器: Spring MVC中的拦截器(Interceptor)类似于Servlet中的过滤器(Filter),它主要用于拦截用户请求并作相应的处理。例如通过拦截器可以进行权限验证、记录请求信息的日志、判断用户是否登录等。在SpringMVC中通过实现HandlerInterceptor接口 阅读全文
posted @ 2019-11-12 16:24 听风忆雪 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 依赖 <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <!-- https://mvnrepository.com/ 阅读全文
posted @ 2019-11-11 17:17 听风忆雪 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Spring MVC异常处理的方式有以下几种 1. <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="defaultErrorView" valu 阅读全文
posted @ 2019-11-11 16:58 听风忆雪 阅读(161) 评论(0) 推荐(0) 编辑
摘要: SpringMVC流程图如上面所示,根据上图,串联一下底层源码: 1.在DispatcherServlet中找到doDisPatch 2.观察方法体,然后找到getHandler方法 3.点进方法,发现也是调用另一个getHandler方法 4.点进方法,发现是一个接口,然后我们进入其抽象类的Abs 阅读全文
posted @ 2019-11-09 17:21 听风忆雪 阅读(320) 评论(1) 推荐(0) 编辑
摘要: 参数传递配置Spring MVC的编码过滤器 <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilte 阅读全文
posted @ 2019-11-09 17:19 听风忆雪 阅读(183) 评论(0) 推荐(0) 编辑
摘要: void返回值类型 如果你的方法写成了Void就跟原来Servlet含义是差不多的json @RequestMapping("/index*") public void firstRequest(HttpServletRequest request, HttpServletResponse resp 阅读全文
posted @ 2019-11-09 16:32 听风忆雪 阅读(555) 评论(0) 推荐(0) 编辑
摘要: Spring MVC的介绍 Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解耦,基于请求驱动指的就是使用请求-响应模型,框架的目的就是帮助我们简化开发,Spring Web MVC也是要简 阅读全文
posted @ 2019-11-07 16:25 听风忆雪 阅读(143) 评论(0) 推荐(0) 编辑
摘要: MyBatis和Spring整合(XML版) 所需要导入的jar文件 <!--MyBatis和Spring的整合包 由MyBatis提供--> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifa 阅读全文
posted @ 2019-11-05 14:50 听风忆雪 阅读(181) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 9 下一页