美文网首页
springmvc注解-RequestMapping

springmvc注解-RequestMapping

作者: 徐卖狼 | 来源:发表于2018-12-03 20:42 被阅读0次

1.什么是RequestMapping?
@RequestMapping:处理地址映射请求的注解,可以用于方法上和类上进行和产生对应的路径

@RequestMapping的参数有6个:
1.value;
用户设置方法或者类的映射,可以直接写路径
如:@RequestMapping("/Student");==@RequestMapping(value="")

2.method;
    指定请求的方法和类型,GET、POST、PUT、DELETE等;

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

4.produces;
    指定返回类容类型,仅当requset请求头中的(Accept)类型中包含该指定类型才返回;
    
5.params;
    指定request中必须包含某些参数值是,才让该方法处理.
    
6.headers;
    指定request中必须包含某些指定的header值,才能让该方法处理请求。

相关文章

网友评论

      本文标题:springmvc注解-RequestMapping

      本文链接:https://www.haomeiwen.com/subject/avmucqtx.html