首页 > 其他分享 >自动注解@WebServlet详细说明

自动注解@WebServlet详细说明

时间:2023-03-22 11:00:49浏览次数:51  
标签:resp req HttpServletResponse WebServlet 自动 Override 注解

/*
 * @WebServlet自动注解:相当于在web.xml文件中配置了servlet
 */
@WebServlet("/servletDemo1")
public class ServletDemo1 extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //
        System.out.println("haha");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }

}

 

标签:resp,req,HttpServletResponse,WebServlet,自动,Override,注解
From: https://www.cnblogs.com/weiduaini/p/17242873.html

相关文章