permaculture playing cards*
The moose likes Servlets and the fly likes HttpServlet class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServlet class" Watch "HttpServlet class" New topic
Author

HttpServlet class

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
why HttpServlet class as Abstract?
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi rex,

it's simply abstract because you should extend it to create your own servlet for your application and at least override one of its service methods this way

Marco
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Hi Marco,
I'm asking the HttpServlet Class API.
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServlet.html
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi rex,

I think I indeed understood you correctly and my answer is still the same

What's the problem because HttpServlet is an abstract class? Usually you make a class abstract if you have no reasonable or just a partly default implementation and you want to define the structure of a concrete class together with the methods a concrete class should implement.

Exactly this is the case with HttpServlet. There's no reasonable implementation for the service methods like doGet(), doPost() etc. because this of course depends on what your concrete servlet in your application should do! The doGet(), doPost() and all the other methods are just declared as a skeleton for concrete servlets because these methods are expected to be called from the servlet container like Tomcat.

Perhaps I misunderstood your question so just tell what's exactly the problem for you with the class HttpServlet being abstract.

Marco
karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259
Hi rex,
Marco was explaining the same HttpServlet Class API.

We should write a Servlet extending this HttpServlet say LoginServlet.java.


http://www.skillassert.com


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpServlet class
 
Similar Threads
extends attribute in page directive
Generic Servlet,HttpServlet
Basic Servlet Doubt
doConnect?
constructor for a servlet