Controller及其方法的注解
来源:互联网 发布:唱歌录音软件 编辑:程序博客网 时间:2024/06/10 19:33
@RestController = @Controller + @ResponseBody
1. 在@Controller注解中,返回的是字符串,或字符串匹配的模板名称,即直接渲染视图,与html页面配合使用。在这种情况下,前后端的配合要求比较高。
2. 在@RestController中,返回的应该是一个对象,而前端的作用是利用返回的json进行解析渲染页面,java后端的代码比较自由。
3. 如果需要返回JSON,XML或自定义mediaType内容到页面,则需要在对应的方法上加上@ResponseBody注解。
@RequestParam、@RequestBody和@PathVariable
@PathVariable 从URL中取得参数
@RequestParam 用来处理简单类型的绑定,用来处理Content-Type为application/x-www-form-urlencoded编码的内容
@RequestBody 该注解常用来处理Content-Type不是application/x-www-form-urlencoded编码的内容
0 0
- Controller及其方法的注解
- @ModelAttribute注解Controller方法的入参
- 基于注解的Controller
- 注解形式Controller方法参数
- 注解形式开发Controller方法的返回值类型
- 基于注解的Controller控制器
- SpringMVC基于Controller的注解
- 使用【SpringMVC】的【Controller注解】
- SpringMVC基于注解的controller
- SpringMVC基于Controller的注解
- @RestController注解与@Controller 注解的区别
- @RestController注解和@Controller注解的区别
- @Controller注解
- @Controller注解
- Sping AOP用AspectJ注解的方式拦截不到SpringMVC的controller方法?
- SpringMVC使用注解完成 URL 和 Controller & 方法之间的映射细节
- spring mvc在注解开发下表单提交到不了Controller方法的解决手段
- springmvc的ModelAttribute注解,在controller每个方法执行前被执行
- 元素、文字垂直居中
- cocoscreator中的调试输出函数
- web测试常用的用例及知识(全)
- 实现在JSP页面对LIST对象级联显示
- 后台框架,走起
- Controller及其方法的注解
- HOG特征提取(一)
- Linux rpm 命令参数使用详解[介绍和应用]
- Ubuntu修复引导
- java利用@interface定义元注解及使用实例
- Cannot find the declaration of element 'beans'
- Python 标准库 urllib2 的使用细节
- 真机测试中设备的UDID加满了如何给新设备打包(iPhone上限100台,以xcode7.3为例)
- C/C++编程语言书籍