Differentiate between GenericServlet and HttpServlet
Sr |
Generic Servlet |
Http Servlet |
1 |
javax.servlet.GenericServlet(abstract class) |
javax.servlet.http.HttpServlet(abstract class) |
2 |
It is the immediate subclass of Servlet interface |
The immediate super class of HttpServlet is GenericServlet |
3 |
It defines a generic, protocol-independent servlet.it can be used with any protocol, say, SMTP, FTP, CGI including HTTP etc |
It defines a HTTP protocol specific servlet |
4 |
GenericServlet is a super class of HttpServlet class. |
HttpServlet is a sub class of GenericServlet class.
|
5 |
All methods are concrete except service() method. service() method is abstract method.
|
All methods are concrete (non-abstract). service() is non-abstract method. service() can be replaced by doGet() or doPost() methods
|