我想在我的类中获取url参数。我的基于Spring MVC的应用程序。使用spring获取URL参数mvc
在呼吁网址:http://localhost:8080/mywebapp/dir/register.do?id=26
提示错误400
@RequestMapping(value = "/register")
public ModelAndView finalPage(@PathVariable("id") Long id) throws NumberFormatException, Exception {
// code...
}
任何人都可以解决我的问题。
您认为'@ PathVariable'如何工作,为什么? – 2014-11-08 17:57:48
使用'@ QueryParam'而不是'@ PathVariable' – Rohan 2014-11-08 18:00:35
@SotiriosDelimanolis我不确定,有没有其他方法? – Bharat 2014-11-08 18:01:20