What is Generic Servlet and how it is different from Http
Servlet?

Answers were Sorted based on User's Feedback



What is Generic Servlet and how it is different from Http Servlet?..

Answer / niranjanravi

The diff is that inGeneracicServlet we had to implement the
service()method the GenericServlets service() method is
declared as abstract.But the Generic Servlet is not
implementing keeping the HttpSErvers in mind. Methods we
have in this class are
init()
log()
service()
While implementing the HTTP Servlet the service() method is
already implemented .service()method of HTTP sevlet is
declared as protected.the HTTPServlet is implementing
keeping the HttpSErvers in mind. Methods we have in this
class are
doGet(),doDelete(),doPost()

Is This Answer Correct ?    18 Yes 4 No

What is Generic Servlet and how it is different from Http Servlet?..

Answer / devarathnam

Hi...The main difference between the Generic and
HttpServlet is :Generic Servlet is Protocol Independent
Where as HttpServlet is protocol dependent ,supports only
HTTP Protocols.And it is a sub class of
GenericServlet,HttpServlet is a Abstract class.

Is This Answer Correct ?    17 Yes 5 No

What is Generic Servlet and how it is different from Http Servlet?..

Answer / l sujata

Actually generic sevlet class is a super class of
HttpServlet class.both of these classes are abstract in
nature.As in generic servlet service () methob is not
defined so they r defined in HttpServlet class. as we are
not interested to create an object of HttpServlet class
so,we make it as abstract class and class that implemnts
HttpServlet Class creates objects and uses three methods
such as init(),service(),destroy() mainly.

Is This Answer Correct ?    6 Yes 3 No

What is Generic Servlet and how it is different from Http Servlet?..

Answer / 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

What is Generic Servlet and how it is different from Http Servlet?..

Answer / luqman khan

HttpServlet is used to handle only http request & response.
where as GenericServlet is used to handle any type of requests.
Http servlet sends large data and its protocol ndependent
whereas GenericServlet sends a small data
Http servlet support cookies sessions.whereas genericservlet
does not support sessions.
Http servlet is protocol dependent.
it is a sub class of GenericServlet.
HttpServlet is a Abstract class.


Answer by M:luqman wazir bcs(5th semester) icup.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Servlets Interview Questions

What is the difference between encodeRedirectUrl and encodeURL?

0 Answers  


Explain mvc pattern.

0 Answers  


Hi friends, am newbie to servlet. My interviewer asked why used servlet in your application. i used servlet for controller logic and business logic . is it correct ?

5 Answers   TCS,


If a servlet is not properly initialized, what exception may be thrown?

0 Answers  


What is the use of servlet wrapper classes?

0 Answers  






How can you start a jta transaction from a servlet deployed on jboss?

0 Answers  


What are all the advantages of servlet over cgi?

0 Answers  


Explain the concept of ssi ?

0 Answers  


What methods do you use in servlet - applet communication?

0 Answers  


How to pass session values from one servlet container to another servlet container? or how can we get session values of one container in another container?

6 Answers   IBM, Infosys, TCS,


Explain the differences between jsp and servlet.

0 Answers  


Difference between GET and POST?

0 Answers  


Categories