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);即可,如下图所示