![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SpringMVC
CN_CodeLab
这个作者很懒,什么都没留下…
展开
-
1 搭建环境
原创地址: http://wiselyman.iteye.com/blog/2213906 1.1 简单示例 通篇使用java config@Controller声明bean是一个控制器@RequestMapping访问路径和方法之间的映射 1.2 演示 1.2.1 新建maven web项目 新建项目 1.2.2 添加spring mvc转载 2016-03-10 11:39:16 · 286 阅读 · 0 评论 -
3 rest
原创地址:http://wiselyman.iteye.com/blog/2214290 3.1 REST REST:Representational State Transfer;REST是一种数据导向web service,相对于SOAP是一种操作操作和处理导向的web service;Spring为对REST的支持提供了@RestController; 在没有@RestCo转载 2016-03-10 11:46:24 · 233 阅读 · 0 评论 -
4 拦截器
原文地址: http://wiselyman.iteye.com/blog/2214292 4.1 拦截器 拦截器实现了对每一个请求处理之前和之后进行相关的处理,类似于Servlet的filter;可以实现HandlerInterceptor接口或者继承HandlerInterceptorAdapter类;继承HandlerInterceptorAdapter类,因为使用接口要实现接口转载 2016-03-10 12:46:19 · 238 阅读 · 0 评论 -
5 服务端推送
原文地址:http://wiselyman.iteye.com/blog/2214626 5.1 服务器端推送 SSE(server send event)是一种服务器端向浏览器推送消息的技术,而不是我们常规的浏览器像server请求然后响应;当我们需要使用server向浏览器主动推送数据的时候,请考虑使用该项技术,而不是考虑具有双向通讯功能的websocket;以前我们用ajax轮询转载 2016-03-10 12:47:59 · 287 阅读 · 0 评论 -
6 上传文件
原文地址:http://wiselyman.iteye.com/blog/2214627 6.1 文件上传 在控制器参数使用@RequestParam("file") MultipartFile file接受单个文件上传;在控制器参数使用@RequestParam("file") MultipartFile[] files接受多个文件上传;通过配置MultipartResolver转载 2016-03-10 12:49:26 · 317 阅读 · 0 评论 -
7 ContentNegotiatingViewResolver
原文地址:http://wiselyman.iteye.com/blog/2214965 7.1 ContentNegotiatingViewResolver ContentNegotiatingViewResolver支持在Spring MVC下输出不同的格式;ContentNegotiatingViewResolver是ViewResolver的一个实现;ContentNegoti转载 2016-03-10 12:51:15 · 923 阅读 · 0 评论 -
8 配置
原文地址:http://wiselyman.iteye.com/blog/2215737 8.1 配置 Spring MVC的配置是通过继承WebMvcConfigurerAdapter类并重载其方法实现的;前几个教程已做了得配置包括 01点睛Spring MVC 4.1-搭建环境 配置viewResolver03点睛Spring MVC 4.1-REST 静态资源映射04点睛S转载 2016-03-10 12:52:46 · 251 阅读 · 0 评论 -
9 异步请求处理
原文地址:http://wiselyman.iteye.com/blog/2215852 9.1 异步请求处理 Servlet 3开始支持异步请求处理Spring MVC 3.2开始支持Servlet3的这项特性controller可以从另外一个线程返回一个java.util.concurrent.Callable,而不是一个简单的值 此时Servlet容器线程已经释放,可以处理转载 2016-03-10 12:54:06 · 330 阅读 · 0 评论 -
10 全局异常处理
原文地址:http://wiselyman.iteye.com/blog/2217746 10.1 全局异常处理 使用@ControllerAdvice注解来实现全局异常处理;使用@ControllerAdvice的属性缩小处理范围 10.2 演示 演示控制器 package com.wisely.web; import org.springframework.转载 2016-03-10 12:55:20 · 254 阅读 · 0 评论 -
2 @RequestMapping
本文为转载,原创地址: http://wiselyman.iteye.com/blog/2213907 2.1 @RequestMapping @RequestMapping是SpringMVC的核心注解,负责访问的url与调用方法之间的映射;@RequestMapping可以放在类和方法上; @RequestMapping的属性produces属性控制response返回的转载 2016-03-10 11:43:37 · 298 阅读 · 0 评论