File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes doGet() Request,Response and doPost() Request,Response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doGet() Request,Response and doPost() Request,Response" Watch "doGet() Request,Response and doPost() Request,Response" New topic

doGet() Request,Response and doPost() Request,Response

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629

I have a few questions.

I always wondered what a doGet()'s request and response does and what a doPost()'s request and response does? Any ideas on this?

Is it ok if I use doPost() all the time instead of a doGet() due to it's benefits when the two methods are compared?

3). writing all the code in doPost() and calling it from doGet(), what is the advantage in this?

[ July 10, 2008: Message edited by: Arjun Reddy ]

Be Humble... Be Nice.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63542

1) This question makes no sense to me.

2) If you don't implement doGet(), GET requests will not be served. If all you are going to make is POSTs, that's fine. Otherwise...

3) Then both GETs and POSTs are handled identically.

[Asking smart questions] [About Bear] [Books by Bear]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9999

Arjun, these are like I told in the other post, please pick up Head First Servlets and JSP and I'm sure you will find answers.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
jQuery in Action, 3rd edition
subject: doGet() Request,Response and doPost() Request,Response
It's not a secret anymore!