What is Generic Servlet and how it is different from Http
Servlet?
Answer Posted / qim2010
Both these classes are abstract but the differences are
A GenericServlet has a service() method to handle
requests.
The HttpServlet extends GenericServlet and adds support
for HTTP
protocol based methods like doGet(), doPost(), doHead()
etc. All
client requests are handled through the service() method.
The service method dispatches the request to an appropriate
method like doGet(), doPost() etc to handle that request.
HttpServlet also has methods like doHead(), doPut(),
doOptions(),
doDelete(), and doTrace().
GenericServlet is Protocol independent. GenericServlet is
for servlets
that might not use HTTP (for example FTP service).
But HttpServlet is protocol dependent (i.e. HTTP).
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What are the new features added to servlet 2.5?
How do we translate jsp?
Write a simple servlet program to print the contents of html.
Difference between get and post in java servlets?
How to upload a file to the server using servlet?
What is a servlet context?
Why the concept of single thread model interface is used?
What if you need to span your transaction across multiple servlet invocations?
Define servlet mapping?
What are the differences between servlet context vs servlet config?
Why is servlet used?
How forward () method is different from send redirect () method?
What is the need of servlet filters?
What is ServletContext object?
What is servlet in tomcat?