首页 > 代码库 > HTTP Status 405 - HTTP method POST is not supported by this URL另外一种原因

HTTP Status 405 - HTTP method POST is not supported by this URL另外一种原因

看了网上的其他解决办法,发现自己的问题并不是那些原因造成的;经过排查还是找到了原因:

@WebServlet("/Ce")
public class Ce extends HttpServlet {
    
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

    }

    
    protected void doPost(HttpServletRequest request, HttpServletResponse response,int id)
            throws ServletException, IOException {
        doGet(request, response);
    }

}

我在doPost后面多写了一个参数int id,可能是在调程序的时候加上去的吧,粗心的我啊,希望大家不要像我一样的粗心!

HTTP Status 405 - HTTP method POST is not supported by this URL另外一种原因