1、@RequestParam用法:

SpringMVC后台控制层获取参数的方式主要有两种,

一种是request.getParameter("name"),

另外一种是用注解@RequestParam直接获取

参考:http://825635381.iteye.com/blog/2196911

2、@RequestMapping

RequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上。用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径。

RequestMapping注解有六个属性,下面我们把她分成三类进行说明。

1、 value, method;

value:     指定请求的实际地址,指定的地址可以是URI Template 模式(后面将会说明);

method:  指定请求的method类型, GET、POST、PUT、DELETE等;

2、 consumes,produces;

consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html;

produces:    指定返回的内容类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回;

3、 params,headers;

params: 指定request中必须包含某些参数值是,才让该方法处理。

headers: 指定request中必须包含某些指定的header值,才能让该方法处理请求。

SpringMVC注解@RequestParam与RequestMapping全面解析的更多相关文章

  1. SpringMVC注解@RequestParam全面解析---打酱油的日子

    在SpringMVC后台控制层获取参数的方式主要有两种,一种是request.getParameter("name"),另外一种是用注解@RequestParam直接获取.这里主要 ...

  2. SpringMVC注解@RequestParam全面解析

    在SpringMVC后台控制层获取参数的方式主要有两种,一种是request.getParameter("name"),另外一种是用注解@RequestParam直接获取.这里主要 ...

  3. SpringMVC注解@RequestParam(转)

    鸣谢:http://shawnccx.iteye.com/blog/730239 -------------------------------------------------- 在SpringM ...

  4. springmvc注解@Controller和@RequestMapping

    Spring从2.5版本引入注解,从而让开发者的工作变得非常的轻松 springmvc注解Controller org.springframework.stereotype.Controller注解类 ...

  5. SpringMVC注解@RequestParam解析

    1.可以对传入参数指定参数名 1 @RequestParam String inputStr 2 // 下面的对传入参数指定为param,如果前端不传param参数名,会报错 3 @RequestPa ...

  6. springmvc 注解 RequestParam/RequestHeader/CookieValue

    RequestParam注解: 示例: @RequestMapping("/testRequestParam") public String testRequestParam(@R ...

  7. SpringMVC注解式开发-RequestMapping放到类上

    功能一:请求地址公共部分,模块名称 (放在类) 功能二:

  8. SpringMVC注解HelloWorld

    今天整理一下SpringMVC注解 欢迎拍砖 @RequestMapping RequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上.用于类上,表示类中的所有响应请求的方法都是 ...

  9. SpringMVC注解@RequestMapping @RequestParam @ResponseBody 和 @RequestBody 解析

    SpringMVC Controller层获取参数及返回数据的方式: @RequestMapping @RequestMapping(“url”),这里的 url写的是请求路径的一部分,一般作用在 C ...

随机推荐

  1. oracle 变量

    插入 日期时间 循环插入 declare total date:) ; begin .. LOOP insert into DQ_DATE(date_time) values ( total ); t ...

  2. 分布式理论——从ACID到CAP再到BASE

    在传统的数据中,有ACID四大原则,在分布式中也有对应的CAP理论和BASE理论,这些都是分布式理论的基础. 更多内容参考:大数据学习之路 ACID ACID分别是Atomicity 原子性.Cons ...

  3. __x__(24)0907第四天__ display 和 visibility

    <a>百度</a>    也是内联元素,无法设置width和height <img>可以设置width和height,但是不会占用一行,所以是典型的行内块元素inl ...

  4. Android Studio下添加assets目录

    Android Studio下添加assets目录 分类: Android Studio2013-11-06 18:09 10872人阅读 评论(2) 收藏 举报 android studioasse ...

  5. 关于three.js中添加文字的方式[转]

    https://blog.csdn.net/qq563969790/article/details/76584976 网上资料大部分是通过引入外部font库进行文字效果的载入,但是在实际运行的时候发现 ...

  6. Face Recognition for the Happy House

    Andrew Ng deeplearning courese-4:Convolutional Neural Network Convolutional Neural Networks: Step by ...

  7. 使用Python登录Github网站

    在下面的代码中, 展示了使用Python脚本登录Github的方法. 如果需要登录别的网站,那么请使用Chrome的Inspect的功能寻找到目标的object,对代码进行替换. 代码先登录了gith ...

  8. python emoji 表情过滤

    http://my.oschina.net/jiemachina/blog/189460 注意替换的这些emoji是标准的表情字符,每个表情本来是2个字节,替换成字符串后,每个表情就变成12个字符了, ...

  9. windows多线程同步--事件

    推荐参考博客:秒杀多线程第六篇 经典线程同步 事件Event   事件是内核对象,多用于线程间通信,可以跨进程同步 事件主要用到三个函数:CreateEvent,OpenEvent,SetEvent, ...

  10. efcore数据库自动生成

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. p ...