Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes Generic servlet 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 "Generic servlet" Watch "Generic servlet" New topic

Generic servlet

Kumar Vinay

Joined: Sep 29, 2000
Posts: 23
I want to know whent to extend generic sevlet and HttpSevlet.
Also i have some confusioun when to call service method,dopost,and doget. Could anybody help me
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
If you are generating web pages and dealing with forms you need to extend HttpServlet. In that case you don't need to change the default service method at all. The servlet container (such as Tomcat) is responsible for calling service - service in turn calls doGet or doPost or whatever according to the user's request.
A normal web page request or a form with method="GET" goes to the doGet method. A form with method="POST" goes to the doPost method.
I agree. Here's the link:
subject: Generic servlet
It's not a secret anymore!