2016-08-17 52 views
-5

我哈瓦簡單的休息方法是這樣的路徑PARAM得到空的,而不是價值

@RequestMapping(value = "/changePlan/{id}", method = RequestMethod.POST) 
public void changePlan(@PathParam("id") String id) { 
    new Planner().changePlan(id); 
} 

有誰知道爲什麼ID在我的情況是空?當我從HttpServletRequest的檢查路徑實際上存在路徑changePlan/123456,但字符串ID仍然是空

+2

對符合條件的投票者的注意:將'讚賞投票到[同義詞](http://stackoverflow.com/tags/spring-mvc/synonyms)'spring-web'到'spring-mvc'。 – chrylis

+0

它真的有這麼多的缺點嗎? – Czarny

+0

鄧諾。我沒有以任何方式投票。 – chrylis

回答

5

@PathParam不是春註解。使用@PathVariable

相關問題