• Post Reply Bookmark Topic Watch Topic
  • New Topic

doGet and doPost method  RSS feed

 
felix thomas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the advantage of calling doGet method from doPost method or vice versa.
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The amount of data you can pass in.

GET requests are limited in most browsers to 256 characters.

All hrefs are GET and all forms are POST.
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually GET is default when nothing else is specified. So forms only submit to doPost if the method in the form is specified as such. Also GET is less secure since data is posted in the url....
[ July 01, 2004: Message edited by: William Duncan ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A frequent pattern that you will see is that the doGet method will call doPost or vice versa. This allows the serlvet to repsond to both GET and POST request in the exact same manner.

If your servlet needs to respond to these differently, then this pattern is not used.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!