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
{
}

Answers were Sorted based on User's Feedback



what is the difference between?when we write the code in following manner? class One extends ht..

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

what is the difference between?when we write the code in following manner? class One extends ht..

Answer / geetha

generic servlet is for all type of protocols and
http are specific to http protocol

Is This Answer Correct ?    3 Yes 2 No

what is the difference between?when we write the code in following manner? class One extends ht..

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

what is the difference between?when we write the code in following manner? class One extends ht..

Answer / ravikiran.chd

the first one will restrict you to make use of http protocol
with the second one we can use other than http protocols as well

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Servlets Interview Questions

Which exception is thrown if servlet is not initialized properly?

1 Answers  


Explain the difference between jsp and servlet?

0 Answers  


What is session variable in servlets?

1 Answers  


How multiple simultaneous requests can be handled by servlets?

2 Answers  


What do you mean by a filter and how does it work?

0 Answers  


What's the advantages using servlets than using cgi?

0 Answers  


what are the way a client can be tracked?

3 Answers   ABC, IBM,


Why doesn’t a servlet include main()? How does it work?

0 Answers  


What is the main purpose of java servlets?

0 Answers  


How do servlets work?

0 Answers  


What is the procedure of invoking different servlet in a different application?

0 Answers  


What do you mean by cgi?

0 Answers  


Categories