What is the difference between GenericServlet, HttpServlet and a Servlet?

前端 未结 10 1716
抹茶落季
抹茶落季 2020-12-23 15:16

I was searching for exact difference between javax.servlet.http.HttpServlet , javax.servlet.GenericServlet and javax.Servlet unable to

10条回答
  •  無奈伤痛
    2020-12-23 15:37

    Servlet:-

    1. The Servlets runs as a thread in a web-container instead of in a seperate OS process.
    2. Only one object is created first time when first request comes, other request share the same object.
    3. Servlet is platform independent.
    4. Servlet is fast.

    GenericServlet:-

    1. General for all protocol.
    2. Implements Servlet Interface.
    3. Use Service method.

    HttpServlet:-

    1. Only for HTTP Protocol.
    2. Inherit GenericServlet class.
    3. Use doPost, doGet method instead of service method.

提交回复
热议问题