关于servlet调用doGet或者doPost以后报405的问题

package com.sparkhuu.servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ServletDemo3 extends HttpServlet {

    /**
     * 
     */
    private static final long serialVersionUID = 2L;
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
//      super.doGet(req, resp);
        resp.getWriter().write("hello servlet");
        System.out.println("********ServletDemo3*********");
    }

}

只需要把调用的super注释掉即可
也可以关注我的公众号关于servlet调用doGet或者doPost以后报405的问题_第1张图片

你可能感兴趣的:(javaweb)