This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes simple question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "simple question" Watch "simple question" New topic

simple question

Jackie Wang
Ranch Hand

Joined: Apr 18, 2002
Posts: 315
Which class does a servlet usually inherit from?

Fully-qualified classname:*
(e.g. "java.lang.Thread")
should it be javax?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
The servlet API provides two classes that you might use as parent to your servlet. If your servlet is to be used to respond to typical HTTP GET or POST requests you would probably use javax.servlet.http.HttpServlet as the parent. If your servlet is to be more general, you might use javax.servlet.GenericServlet as the parent.
One of the nice things about Tomcat is that it comes with complete JavaDocs for these packages.
I agree. Here's the link:
subject: simple question
It's not a secret anymore!