This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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: 13006
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!