zoukankan      html  css  js  c++  java
  • @getMapping与@postMapping

    首先要了解一下@RequestMapping注解。

      @RequestMapping用于映射url到控制器类的一个特定处理程序方法。可用于方法或者类上面。也就是可以通过url找到对应的方法。

      @RequestMapping有8个属性。

    value:指定请求的实际地址。

    method:指定请求的method类型(GET,POST,PUT,DELETE)等。

    consumes:指定处理请求的提交内容类型(Context-Type)。

    produces:指定返回的内容类型,还可以设置返回值的字符编码。

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

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

    @getMapping与@postMapping是组合注解。

    @getMapping = @requestMapping(method = RequestMethod.GET)。

    @postMapping = @requestMapping(method = RequestMethod.POST)。

  • 相关阅读:
    Evensgn 的债务
    Passward
    拯救莫莉斯
    文艺平衡树
    Fliptile 翻格子游戏
    Making the Grade (bzoj1592)
    紧急疏散evacuate
    Password
    [NOIP2015]斗地主
    运输问题1
  • 原文地址:https://www.cnblogs.com/telwanggs/p/10791640.html
Copyright © 2011-2022 走看看