HTTP Status 405 - HTTP method GET is not supported by this URL


問題概述: 借助MyEclipse直接建立了一個Servlet類,每次訪問這個Servlet都能訪問。可自己建立一個Servlet為什么總提示:HTTP Status 405 - HTTP method GET is not supported by this URL。的確是繼承了HttpServlet,而且是重寫了它的doGet()、doPost()方法(注意這兩種方法一定要寫)

public class SearchServlet extends HttpServlet{
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  // TODO Auto-generated method stub
  super.doPost(req, resp);
  }
}

解決:問題出來藍色那行代碼,事實上我們是不需要去調用父類的doPost()方法,去掉就可以了!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM