我的控制器具有以下呼叫正在添加到客戶端防止我的命令對象的JSON從一開始讓我的UsersCommand對象的JSON期間後在
@ModelAttribute("commandObject")
public UsersCommand getCommand(HttpServletRequest req) throws Exception {
...
return command;
}
@RequestMapping(value = {"addusers.json"}, method = RequestMethod.GET)
public void handleGet() {
//empty method
}
@RequestMapping(value = {"addusers.json"}, method = RequestMethod.POST)
public void handlePost(@ModelAttribute("commandObject") UsersCommand command, HttpServletRequest req) throws Exception {
//do stuff
}
,我做一個帖子但是之後,我得到我不需要的命令對象的json,因爲我想做一個消防和忘記帖子。
如何避免json對象在發佈期間回到瀏覽器?
嗨,你能詳細說明這個映射 只是好奇這個映射如何工作。我意識到價值=「/路徑」。 (value = {「addusers.json」}意思是什麼 – user1889970
我無法弄清楚你的代碼是幹什麼的,我想不出你的get方法是怎麼做的。 body? –
@ steve.hanson:get方法沒有任何實現,我仍然是一個noobie,並且學習了spring的微妙複雜性,不確定'handleGet'的作用,看起來好像它可能什麼都不做。確定當我通過ajax調用從jsp頁面調用我的控制器時,如何調用getCommand'。ajax調用只調用我的控制器爲'http:// mylocalhost/addusers.json' – user1361914