我有一個URL像這樣爪哇 - 獲取URL的參數
我使用的是發揮框架
HTTP路線:
GET /students controllers.Application.Get()
POST /students controllers.Application.Post()
PUT /students/{studentNo} controllers.Application.Put()
我將如何得到{studentNo}價值?例如,我正在使用郵遞員(其餘客戶端),並且我在URL http://localhost:9000/students/2012111222中鍵入了一些內容,我將如何獲取「2012111222」。我是否需要拆分URL的值才能獲取該參數或者是否有其他內容。謝謝。!
你用什麼框架(球衣?)u能提供一些更多的代碼獲取的價值?一個猜測:嘗試像這樣:'public void myPost(@PathParam(「studentNo」)studentNo){... some code ...}' – DonMushroom
我正在使用Play框架。對不起如果我沒有提到。 – Zelgh
你有一些代碼嗎?例如一個get方法?這個網址指向哪裏? – DonMushroom