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

Should I override the service() method?

674


Explain the custom jsp tags and the beans.

620


How can I send user authentication information while making URL Connection?

552


Which are the different ways you can communicate between servlets?

536


Which interface should be implemented by all servlets?

703






What is Client-Server Computing?

1903


How the JSP file will be executed on the Server side?

650


Is servlet a framework?

547


What is servlet in simple terms?

578


What is the dispatcher servlet?

519


Why do we use sendredirect() method?

558


When should you prefer to use doget() over dopost()?

670


What is the inter-servlet communication?

707


What is the purpose of dispatcherservlet properties?

518


Can we get PrintWriter and ServletOutputStream both in a servlet?

666