springmvc的controller方法不指定method时可以GET或POST提交


springmvc的controller方法不指定method时可以GET或POST提交
https://blog.csdn.net/linlinxie/article/details/79036133

在写controller的方法时

    @RequestMapping("page")
    //@RequestMapping(value = "page", method = RequestMethod.GET)    写法二
    //@RequestMapping(value = "page", method = RequestMethod.POST)   写法三
    public ModelAndView page(String test) {
        logger.info(">>>>>>" + test);
        ModelAndView mav = new ModelAndView("appeal/roleManage");
        return mav;
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

第一种写法没指定method,前端提交时可使用get或者post,第二种只能使用get,第三种只能使用post