Method Not Allowed

Method Not Allowed_第1张图片

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);
        
}

你可能感兴趣的:(java,Expection)