在我的Web应用程序中,我正在尝试使用此格式进行URL:
http://host/admin/users/edit/{id}
http://host/admin/users/edit/20 -> 20 represents the id param
我正在尝试使用@request映射这样的
@Override
@RequestMapping(path = { "/admin/users/edit/{id}" }, method = RequestMethod.GET, params = { "id" })
public ModelAndView editUserInfo(@RequestParam(value = "id", required = true) Long id) {
...
}
我不想在没有配置友好URL的情况下使用url?param=value
格式。
预先感谢。
为了做你想做的事情,必须写下以下内容:
@Override
@RequestMapping(path = { "/admin/users/edit/{id}" }, method = RequestMethod.GET)
public ModelAndView editUserInfo(@PathVariable("id") Long id) {
...
}
PathVariable
用于参数变量,RequestVariable
用于请求参数
angelo