4**`@RequestMapping` **注解的 **method **属性

    • @RequestMapping 注解的 method 属性通过请求的请求方式(getpost)匹配请求映射。
    • @RequestMapping 注解的 method 属性是一个 RequestMethod 类型的数组,表示该请求映射能够匹配多种请求方式的请求。

    • 若当前请求的请求地址满足请求映射的 value 属性,但是请求方式不满足 method 属性,则浏览器报错

    405``:``Request method 'POST' not supp

    测试:

    • Controller:

      1. @RequestMapping( value = {"/testRequestMapping", "/test"}, method = {RequestMethod.GET, RequestMethod.POST} )
      2. public String testRequestMapping(){
      3. return "success";
      4. }
    • HTML: ```html 测试@RequestMapping的value属性—>/test

    ```