Method Not Allowed

javaweb  method not allowed

HTTP Status 405 ? Method Not Allowed
Type Status Report

Message HTTP method POST is not supported by this URL

Description The method received in the request-line is known by the origin server but not supported by the target resource.

解决办法:

在重写doGet()或是doPost()方法时,去掉父类的调用!
如下:

package com.paul.test;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;
import java.sql.*;

/**
 * @author HaoPu
 * @date 2018/8/12 0012
 * @brief
 */
public class proServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.doGet(req, resp);//注释掉
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.doPost(req, resp);
        
}

版权声明:本文为u014141841原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。