zoukankan      html  css  js  c++  java
  • servlet

    常见接口

    servlet方法有:

      void destory()

      ServletConfig getServletConfig()

      void init(ServletConfig config)

      void service (ServletRequest req,ServletResponse res)

    ServletConfig是servlet容器初始化servlet时传给init()方法的参数。

    RequestDispatcher(请求转发)

    void forward(ServletRequest req,ServletResponse res)

    void include(ServletRequest req,ServletResponse res)

    ServletRequest(an object to provide client request information to a servlet)

    object getAttribute(String name)

    void setAttribute(String name,object o)

    String getParameter(String name)

    RequestDispatcher getRequestDispacher(String path)

    ServletContext getServletContext()

    SerlvetResponse(an object to assist a servlet in sending a response to the client. )

    PrintWriter getWriter()

    void setCharacterEncoding()

    ServletContext(a set of methods that a servlet uses to communicate with its servlet container)

    void addListener(String className)

    常见类

    GenericServlet(实现servlet接口)(a generic, protocol-independent servlet)

     方法与servlet基本一致

    Httpservlet(an abstract class to be subclassed to create an HTTP servlet suitable for a Web site)

    void doGet(HttpServletRequest req,HttpServletResponse res)

    void doPost(HttpServletRequest req,HttpServletResponse res)

    封装了init和destoty方法,在底层servlet中实现

  • 相关阅读:
    6.11 修饰符的适用范围
    5.10 对象与垃圾回收
    5.9 枚举类
    5.8 java 11增强的Lambda表达式
    5.7 内部类
    5.6 接口
    5.5 抽象类
    5.4 final修饰符
    5.3 类成员
    5.2 Object类中两个需要被重写的方法
  • 原文地址:https://www.cnblogs.com/kundeg/p/6431584.html
Copyright © 2011-2022 走看看