HTTP method GET is not supported by this URL 报错解决

Posted L_不觉晓晓

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTTP method GET is not supported by this URL 报错解决相关的知识,希望对你有一定的参考价值。

1、错误信息:HTTP method GET is not supported by this URL
2、字面理解:Get方法不能为URL请求的支撑工作
3、解决方案:查看该功能对应的servlet类,是否重写了doGet()、doPost()方法,并使用doGet()方法完成servlet中功能的实现及函数的调用操作。如果重写了doGet()、doPost()方法,记得删除自动生成的super.doGet(req, resp)和super.doPost(req, resp)

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
        //super.doGet(req, resp);
        System.out.println("这里是get请求");
    

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
        //super.doPost(req, resp);
        System.out.println("这里是post请求");
    

以上是关于HTTP method GET is not supported by this URL 报错解决的主要内容,如果未能解决你的问题,请参考以下文章