@PathVariable
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
public UserDto getById(@PathVariable("id") Long id){
...
}
@RequestParam
參數都使用@RequestParam注入,那麼地址的拼寫是不需要加參數的。
@RequestMapping(value = {"/findDictionarybyTypeId"},
method = RequestMethod.GET)
@ResponseBody
public ItooResult findDictionarybyTypeId(HttpServletRequest request,
HttpServletResponse response, @RequestParam(required = false, defaultValue = "")
String typeId, @RequestParam(required = false, defaultValue = "") String dictionaryInfo)
————————————————
版權聲明:本文爲CSDN博主「馮浩月」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/m18633778874/article/details/80728490
此段代碼中@PathVariable可以將URL中的佔位符參數{**}綁定到處理器類的方法形參中(佔/{})
引用於:https://blog.csdn.net/sswqzx/article/details/84194979
引用於:https://blog.csdn.net/sswqzx/article/details/84194979