2013-07-02 134 views
1

我正在使用Play框架開發Web應用程序。我想通過動態URI傳遞一個變量。我正在按照here所示的示例進行操作。不過,我收到此錯誤:Play Framework無法識別路徑參數

not enough arguments for method showClients: (clientId: Long)play.mvc.Result. Unspecified value parameter clientId. 

路線文件:

GET  /clients/{clientId}     controllers.Application.showClients 

控制器代碼:

public static Result showClients(Long clientId) { 
    Client c = clientFinder.byId(clientId); 
    return ok(client.render(c)); 
} 

URL

http://localhost:9000/clients/1 

有誰看到一個問題,我碼?在Google搜索後,我發現了類似的問題,但沒有人遇到完全相同的問題,所以我認爲這很簡單。謝謝您的幫助。

回答

6

哎呀......看起來我正在查看以前版本Play的文檔。當前文檔here表明我的路線文件應該是這樣的:

GET /clients/:clientId  controllers.Application.showClients(clientId : Long) 

由於任何人誰看着尋找一個問題的答案。