Results 1 to 4 of 4
Thread: About doGet & doPost methods
- 11-27-2007, 05:29 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 4
- Rep Power
- 0
- 12-03-2007, 03:17 PM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 697
- Rep Power
- 6
It will be called by the servlet container base on the get or post action from the client. For instance if you have an html form with the action equals to get then it will be handled in the doGet method and if the action equals to post then the action will be handled in the doPost method.
Website: Learn Java by Examples
- 12-04-2007, 06:08 AM #3
Member
- Join Date
- Nov 2007
- Posts
- 4
- Rep Power
- 0
Thank u very much for ur reply.
I have again one question that servlet container calls a service() method to call doGet() or doPost() then if we will overload service() in our servlet class then can it be overloaded ? If yes what will be the use of doGet & doPost methods ?
- 12-04-2007, 07:02 AM #4
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 697
- Rep Power
- 6
You need to know that actually Servlet is not just used for a web application, you can implement the Servlet for instance as a desktop based application. In the case of the service method implemented by the HttpServlet is because the contract defined in the servlet interface that should obeyed by the implementor.
It would be better not to override the service method in the HttpServlet because the service method is implemented to handle the specific http request which then will be delegated to the specific method to handle a specific user request type, eg. the GET or POST.
If you still need to override the method then don't forget to call the super.service() so the doGet or doPost will still executed after you if done with the service method logic that you've implemented.Last edited by wsaryada; 12-04-2007 at 07:06 AM.
Website: Learn Java by Examples
Similar Threads
-
Setting cookie from doPost
By Java Tip in forum Java TipReplies: 0Last Post: 01-25-2008, 07:08 PM -
Example of doGet
By Java Tip in forum Java TipReplies: 0Last Post: 01-25-2008, 07:07 PM -
methods
By Zensai in forum New To JavaReplies: 10Last Post: 12-03-2007, 05:31 AM -
Methods
By Java Tip in forum Java TipReplies: 0Last Post: 12-01-2007, 08:49 PM -
doPost question
By Heather in forum Java ServletReplies: 1Last Post: 07-09-2007, 03:13 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks