Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

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

Answer Posted / rajavardhan reddy k

1.GenericServlet is direct implementation of Servlet
interface.In GenericServlet the servlet lifecycle method
service() is not implemented. so it's declared as
abstract.It will be useful whenever we developing the
applications based on the protocols like FTP. even it can
be used to develop HTTP based applications.GenericServlet
is in javax.servlet package.
2.HTTPServlet is indirect implementation of Servlet
interface.HTTPServlet implements all the methods of Servlet
interface.It's specific to HTTP protocol.In these days most
of the applications are web based applications(HHTP
protocol based). so that to simplify the development work
Sun people intoduced HTTPServlet class.HTTPServlet is a
abstract class even it's implements all the abstract
methods.sun people don't want to allow to create a object
for HTTPServlet so they declared it as a abstract class.In
HTTPServlet class 2 service methods are declared.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What’s the difference between genericservlet and httpservlet?

1021


How do we translate jsp?

990


Tell us something about servletcontext interface.

1033


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

988


Explain the difference between servletconfig and servletcontext in servlet?

989


What exception should be thrown when servlet is not properly initialized?

963


What are the annotations used in servlet 3?

995


What are the new features added to servlet 2.5?

1043


What are the differences between servlet context vs servlet config?

1021


What are the two important api's in for servlets?

1014


Is tomcat a servlet container?

980


What is Request Dispatcher?

1362


How can an existing session be invalidated?

1100


How do you create a cookie using servlet?

1094


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

1027