• JSP(2)--Servlet解析


    1.具体结构

    2.重要接口源码

    (1)Servlet:

    public void init(ServletConfig config) ;
    public ServletConfig getServletConfig();
    public void service(ServletRequest req, ServletResponse res);
    public String getServletInfo();
    public void destroy();

    (2)ServletConfit

    一些Servlet配置信息

    public String getServletName();
    public ServletContext getServletContext();
    public String getInitParameter(String name);
    public Enumeration<String> getInitParameterNames();

    (3)ServletContext

    Servlet上下文

    public String getContextPath();
    public int getMajorVersion();
    public int getMinorVersion();
    public String getMimeType(String file);
    ...........

    3.Servlet的生命周期

    1.用户请求服务器时加载Servlet(可以在web.xml里面设置服务器初始化是打开)

    2.init()

    3.调用Service() 处理请求,重写doGET ,doPOST

    4.返回结果

    5.Web容器关闭时destroy()

  • 相关阅读:
    Nodejs-原型链污染
    dpwwn-02靶机渗透
    dpwwn-01靶机渗透
    Bulldog1靶机渗透
    php+html实现用户登录退出
    DC4靶机
    vulnhub-Os-hackNos-3
    Linux系统解析XML中文乱问题
    idea添加database
    PL/SQL学习笔记
  • 原文地址:https://www.cnblogs.com/blogofjzq/p/9234015.html
Copyright © 2020-2023  润新知