@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) {
}