Spring MVC referencing params variable from RequestMapping

后端 未结 2 1009
情话喂你
情话喂你 2020-12-28 15:29

I have the method below:

@RequestMapping(value = \"/path/to/{iconId}\", params=\"size={iconSize}\", method = RequestMethod.GET)
public void webletIconData(@P         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-28 15:54

    Use @RequestParam:

    @RequestMapping(value = "/path/to/{iconId}", method = RequestMethod.GET) 
    public void webletIconData(@PathVariable String iconId, 
        @RequestParam("size") String iconSize, 
        HttpServletResponse response) throws IOException { ... }
    

    See also:

    • 15.3.2.3 Supported handler method arguments and return types

提交回复
热议问题