• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

HttpServlet class

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why HttpServlet class as Abstract?
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi rex,
Marco was explaining the same HttpServlet Class API.

We should write a Servlet extending this HttpServlet say LoginServlet.java.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic