• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing both doGet() and doPost()

 
Abhishek khare
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going through the Head First book for SCWCD and encountered the following : Chap-4 Page 118

"It says if a developer wants to support both the methods usually put logic in doPost(), then delegate to a doGet() if this request doesn't need to do post things:"

Not sure if I understand it..in my experience what I have seen is that if required we implement both doGet() and doPost() separately.

It would be helpful if somebody could explain what the above means...

Thanks
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhishek khare wrote:"It says if a developer wants to support both the methods usually put logic in doPost(), then delegate to a doGet() if this request doesn't need to do post things:"

It simply means like this:



Abhishek khare wrote:in my experience what I have seen is that if required we implement both doGet() and doPost() separately.

Now, I'm not sure about this, I never seen such code which had a different request processing for different action, but we can set the error code, stating "GET/POST action is not supported" kind of server error in doGet() or doPost() method.
 
Abhishek khare
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...got it..thanks
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic