我想在我的類中獲取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