0%

spring | @PathVariable

@PathVariable 注解讲解。

  • URL
    • http:127.0.0.1:8888/hello/getbyid/12
1
2
3
4
5
6
7
@RequestMapping(value = "/getbyid/{id}", method = RequestMethod.GET)
@ResponseBody
private Map<String, Object> getbyid( HttpServletRequest request,@PathVariable("id") int idnum){
Map<String, Object> modelMap = new HashMap<String, Object>();
modelMap.put("idnum", idnum);
return modelMap;
}
请我喝杯咖啡吧~