zoukankan      html  css  js  c++  java
  • 参数类型 (@Controller层)

    @RequestMapping(path = "/listPage")
    @SuppressWarnings("unchecked")
    @BussinessLog(value = "查询财务信息列表", key = "listPage") @ResponseBody
    public Object listPage(String condition,Integer adPositionId) {return super.packForBT(result); }
    @RequestMapping("/advInfo_update/{advId}")
    public ModelAndView goAdvInfoUpdate(@PathVariable Integer advId) {return mv;
    }
    @RequestMapping("/zyh/{type}")
      public String zyh(@PathVariable(value = "type") int type) throws UnsupportedEncodingException {
        String url = "http://wx.diyfintech.com/zyhMain/" + type;
      }

    复杂参数,实体类参数

    @RequestMapping("/delete")
    @ResponseBody
    public Object deleteAdv(AdvAdInfo advInfo) {return SUCCESS_TIP;
    }

    springMVC中的注解@RequestParam与@PathVariable的区别

    在SpringMVC后台控制层获取参数的方式主要有两种:

    一种是request.getParameter("name"),另外一种是用注解@RequestParam直接获取

    这里主要讲这个注解 @RequestParam

    接下来我们看一下@RequestParam注解主要有哪些参数:

    value:参数名字,即入参的请求参数名字,如username表示请求的参数区中的名字为username的参数的值将传入;

    required:是否必须,默认是true,表示请求中一定要有相应的参数,否则将报404错误码;

    defaultValue:默认值,表示如果请求中没有同名参数时的默认值,例如:

    public List<EasyUITreeNode> getItemTreeNode(@RequestParam(value="id",defaultValue="0")long parentI

        @RequestMapping("listcarbrandinfo")
        public ResultEntity listCarBrandInfo(@RequestParam(name = "data", required = true) String data,
                @RequestParam(name = "userid", required = false) Integer userId) {
    }
  • 相关阅读:
    python之面向对象
    Python常用模块(logging&re&时间&random&os&sys&shutil&序列化&configparser&&hashlib)
    Python之模块与包
    2.1 、寻找元素 (重要的选择器和筛选器)
    4、循环语句 和 异常处理
    7、其他知识点
    2、函数 面向对象
    3、数据类型
    1、初识JavaScript
    2、css
  • 原文地址:https://www.cnblogs.com/dianzan/p/11244412.html
Copyright © 2011-2022 走看看