Type: Status Report
Messsage: HTTP method GET is not supported by this URL
Description: The specified HTTP method is not allowed for the requested resource.
錯(cuò)誤原因:
1.繼承自HttpServlet的Servlet沒有重寫對(duì)于請(qǐng)求和響應(yīng)的處理方法:doGet或doPost等方法;默認(rèn)調(diào)用父類的doGet或doPost等方法;
2.父類HttpServlet的doGet或doPost等方法覆蓋了你重寫的doGet或doPost等方法;
父類HttpServlet的doGet或doPost等方法的默認(rèn)實(shí)現(xiàn)是返回狀態(tài)代碼為405的HTTP錯(cuò)誤表示對(duì)于指定資源的請(qǐng)求方法不被允許。
解決方法:
1.子類重寫doGet或doPost等方法;
2.在你擴(kuò)展的Servlert中重寫doGet或doPost等方法來處理請(qǐng)求和響應(yīng)時(shí) 不要調(diào)用父類HttpServlet的doGet或doPost等方法,即去掉super.doGet(request, response)和 super.doPost(request, response)。
如果子類僅僅重寫的是doGet或doPost其中一個(gè)方法,而沒有另一個(gè)方法,也會(huì)報(bào)405錯(cuò)誤
只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
|
||