方法的映射地址: kjplatform/api/dz/{date}, 我需要怎么写能拿到dz 跟date ,还是说
我需要传一个HttpservletRequest类型的参数?
controller层的RequestMapping的value: kjplatform/api/dz/{date}, 我需要怎么写能拿到dz 跟date
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
TinerSky 2019-03-14 09:46关注不用HttpservletRequest也可以,直接使用@PathVariable注解。
代码如下:@RequestMapping(value = "/download/{id}/{date}/", method = RequestMethod.GET) public void download(HttpServletResponse response, @PathVariable String id, @PathVariable String date) { System.out.println("id = " + id); System.out.println("date = " + date); }运行截图:

访问地址(仅供参考):
http://localhost:8088/kjplatform/api/download/52457821/2019-03-14/本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报