前台请求参数与后台方法参数一致与不一致的情况
1. 函数参数名与请求参数名保持一致
@RequestMapping("/delete")
@ResponseBody
public JsonResult delete(Long id){
2. 函数参数名与请求参数名保持不一致
@RequestMapping(value = "/add", method = RequestMethod.POST)//参数是对象
public AjaxResult save(@RequestBody Product product) {
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
public AjaxResult delete(@PathVariable("id") Long id) {
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Product get(@PathVariable(value = "id", required = true) Long id)
@RequestMapping(value = "/redis",method = RequestMethod.POST)
@Override
public void set(@RequestParam("key") String key,@RequestParam("value") String value){
RedisUtil.set(key,value);
}