spring @PathVariable:请求路径url 上有变量值,可以通过@PathVariable来获取

泄露秘密 提交于 2019-12-05 19:21:05

请求路径url 上有个变量值,可以通过@PathVariable来获取  


示例:id为变量值:@RequestMapping(value = "/page/{id}", method = RequestMethod.GET)                


Tool tool = new Tool();

tool.setUrls(new String[]{"finance/account/loanDownExcel/cur","finance/account/loanDownExcel/all"});



@RequestMapping("accountlog/loanDownExcel/{type}")
public void exportAccountLogExcel(@PathVariable("type")  String type)throws Exception {}
或者是

public void exportAccountLogExcel(@PathVariable   String type)throws Exception {}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!