package com.lovecoding.servlet01;

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;
import java.io.PrintWriter;

/**
 * ClassName: MyServlet
 * Package: com.lovecoding.servlet01
 * Description:
 *
 * @Author 爱扣钉-陈晨
 * @Create 2023/5/31 15:50
 * @Version 1.0
 */

@WebServlet(name = "MyServlet" , value = "/myservlet")
public class MyServlet extends HttpServlet {

    @Override
    public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        System.out.println("MyServlet执行");
        //HttpServletResponse 响应对象
        PrintWriter writer = resp.getWriter();
        //响应页面信息
        writer.write("MyServlet返回");
    }
}
