zoukankan      html  css  js  c++  java
  • 前台请求参数与后台方法参数一致与不一致的情况

    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);
    }
     
  • 相关阅读:
    访问修饰符的权限。
    字符编码
    3/11 作业
    3/10 作业
    作业 3/9
    流程控制之for循环
    Exception in createBlockOutputStream
    windows上传文件到 linux的hdfs
    win10 配置 hadoop-2.7.2
    hadoop 源码编译
  • 原文地址:https://www.cnblogs.com/wgyi140724-/p/10736379.html
Copyright © 2011-2022 走看看