我正在使用澤西島在我的產品中實現REST api服務。要獲取表單參數值,我試圖在我的方法中使用@FormParam註釋。但在eclipse中它會拋出錯誤「註釋@FormParam不允許用於這個位置」。不能在方法內使用註釋
如何解決這個問題?
我正在使用澤西島在我的產品中實現REST api服務。要獲取表單參數值,我試圖在我的方法中使用@FormParam註釋。但在eclipse中它會拋出錯誤「註釋@FormParam不允許用於這個位置」。不能在方法內使用註釋
如何解決這個問題?
請勿將註釋放在方法內。註釋通常放在面前:
(however, more possibilities are available)
在你的情況
public String addUser(@FormParam("emailid") String emailid,
@FormParam("password") String password) {
...
}
使request.getParameter(...)不需要。
第一行是錯誤的。該方法中不允許使用特定註釋('@ FormParam'),其他註釋(例如'@ SuppressWarnings') – SJuan76 2015-02-06 20:06:51
爲什麼你需要用'@ FormParam'如果你正在通過'request.getParameter'參數?你應該重新審視你的澤西島教程。 – 2015-02-06 19:52:35