這個問題看似微不足道,但我無法讓它正常工作。我打電話給我的Spring控制器映射與jQuery的Ajax。無論url中的值如何,someAttr的值始終爲空字符串。請幫我確定原因。如何通過彈簧控制器映射接收url參數
-URL稱爲
http://localhost:8080/sitename/controllerLevelMapping/1?someAttr=6
-Controller映射
@RequestMapping(value={"/{someID}"}, method=RequestMethod.GET)
public @ResponseBody int getAttr(@PathVariable(value="someID") final String id,
@ModelAttribute(value="someAttr") String someAttr) {
//I hit some code here but the value for the ModelAttribute 'someAttr' is empty string. The value for id is correctly set to "1".
}