what is the difference between?when we write the code in
following manner?

class One extends httpservlet
{
}
and
class One extends genericservlet
{
}

Answer Posted / saikiran

We are extending GenericServlet because of 3 Reasons
1.no need to implement 5 metods JVM will take the
responsibility to implement 4 methods init(),deistroy
(),getServletConfig(),getServletInfo()
2.Object to Object communication
2 point is there in java1.0 that is not there because of
when the Object is taking Anther Object Reference that
was unnessarly misusing
finnaly we don't have much benifits and we are
UnNecessarly Incresing the Load on JVM
We are extending HttpServlet Because of
People are Mainly Using Http in Most of the Time for
that sun has given API to Convinient to those People
Note:GenericServlet and HttpServlet are Doesn't knows to
ServletContainer
Because of that was Violationing the
1.Public with NonAbstract

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why filter is used in servlet?

728


How to make sure a servlet is loaded at the application startup?

746


What are the steps that are required to handle the multi-threading?

832


What is Request Dispatcher?

1052


Which event is fired at the time of setting, getting or removing attribute from application scope?

855


Why do you use session tracking in httpservlet?

829


List out difference between a JavaBean from a Servlet?

732


What is context in servlet?

741


What are the different mode that servlets can be used?

750


What is called servlet container?

826


Write a program to show the functionality of servlets.

734


Explain the features are in servlet 3?

794


What are the various ways of session supervision in servlets?

731


What is a web container and what is its responsibility?

706


What exactly is a servlet?

697