解决405错误
作者:互联网
package com.xyxy.servlet;
//import javax.jws.WebService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/ser01")
public class Servlet01 extends HttpServlet{
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//super.service(req, resp);
//打印内容在控制台
System.out.println(“hello servlet”);
//通过流输出数据到浏览器
resp.getWriter().write(“hello servlet”);
}
}
去掉super.service(req,resp);即可,如下图所示
标签:http,错误,resp,req,405,解决,import,servlet,javax 来源: https://blog.csdn.net/m0_52349214/article/details/116162338