• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

diff b/w generic servlet and http servlet

 
ramchander yshetti
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
->i working with generic servlet and httpservlet
but same output is coming.

->why we have to use httpservlet,instead of generic servlet.

->what is the diff b/w generic servlets and http servlets.

->please answer my questions, i will be grateful to you
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by yathamshetti ramchander:
hai,
->i working with generic servlet and httpservlet

Why?

->why we have to use httpservlet,instead of generic servlet.

Who said you have to?

->what is the diff between generic servlets and http servlets.

The differences can be seen here:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServlet.html
The methods particular to HttpServlet are listed first.
Then, the methods inherited from GenericServlet are listed.

When the servlet spec was first conceived, it's creators realized that this concept could apply to several server protocols. So, rather than add a bunch of methods to the servlet interface that would be igored by any implementation other than HTTP (such as doPost, doGet), they designed the generic servlet with no protocol specific methods. Then, when desiging a servlet interface specifically for HTTP, they inherited from this generic servlet and added HTTP specific methods.

At this time, there are no servlet implementations for protocols other than HTTP; at least none are known to me.

In other words, there is almost no point in extending GenericServlet while building web-apps.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this issue is brought up here quite frequently, I've added it to the ServletsFaq.
 
Janakiram Gattupalli
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GenericServlet is designed to implement irrespective of the protocl.Let us take an example.The servlets that runs inside a web-container(http server) are called as HttpServlets.Like this if the servlet technology is implemented as part of X servers then we call it as X servlet.
 
ramesh kothakonda
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
generic servlet is protocal independent servlet

where as the httpservlet is the http protocal dependent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic