Why does most servlets extend HttpServlet?

Answers were Sorted based on User's Feedback



Why does most servlets extend HttpServlet?..

Answer / surajkumar.java

Yes, HttpServlet simplifies the handling of HTTP protocol but there is no hard and fast rule that the servlet class must extend abstract HttpServlet class. it may extend GenericServlet class to make the Servlet protocol independent.

Is This Answer Correct ?    8 Yes 1 No

Why does most servlets extend HttpServlet?..

Answer / surajkumar.java

Almost all servlets written today are designed to use the HTTP
protocol, so most servlets currently extend the
javax.servlet.http.HttpServlet class.

Is This Answer Correct ?    4 Yes 1 No

Why does most servlets extend HttpServlet?..

Answer / magesh

The GenericServlet which is the base class of HttpServlet
does not have any handler methods (doGet or doPost) to
entertain the request.Since all web based application or
HHTP based we are extending the HttpServlet and overrinding
atleast one of the hanler methods to entertain the incoming
requests

Is This Answer Correct ?    3 Yes 1 No

Why does most servlets extend HttpServlet?..

Answer / dhiraj

All servlet classes extend the HttpServlet abstract class.
HttpServlet simplifies writing HTTP servlets by providing a
framework for handling the HTTP protocol. Because
HttpServlet is abstract, your servlet class must extend it
and override at least one of its methods. An abstract class
is a class that contains unimplemented methods and cannot be
instantiated itself.

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More Advanced Java Interview Questions

What are the different types of exception?

0 Answers  


What is the difference between the session.get() method and the session.load() method?

0 Answers  


Difference Between getRequest and PostRequest?

8 Answers   HCL, TCS,


Why are some of the class and element names counter-intuitive?

0 Answers  


What is the purpose of the finally clause of a try-catch-finally statement?

0 Answers  






difference between sql exception class and sql warning class

1 Answers  


What is the priority of Garbage collector thread?

3 Answers  


what is singleton class? where it mainly used in the projects?

5 Answers   Satyam, Wipro,


How to do registration form using struts and hibernate?

1 Answers  


In real time project when will we use Abstract class. and what are the difference between abstract and interface.

6 Answers   DELL, FCS, Polaris, Tanla Solutions, TCS,


What is the difference between the session.update() method and the session.lock() method?

0 Answers  


what is the Remote Stub?

1 Answers  


Categories