This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Calling doGet() from doPost()  RSS feed

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this has already been discussed...

In Servlets, why would you want to call doGet() from your doPost() method as I see some examples doing?

 
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually, it's lazy design. Someone didn't want to decide in advance whether the page should use GET or POST, or possibly just didn't understand the difference. I've done that myself too. In the past, when I didn't understand HTTP properly. Now I don't do it.

It's also possible that there are old tutorials on the web which do that too. That's quite likely why I decided to do it. All kinds of things are done in the early days of a technology which later we realize were not so good, and that could be one of those things. Then people find these tutorials (for some reason it seems to be easier to find old tutorials than new ones) and propagate the meme.

I suppose there might be designs where there exist pages which send GET requests to the servlet and also other pages which send POST requests to the same servlet. And if the system was legacy enough, it might be hard to track them all down and standardize the usage, so you'd use this approach to compensate for that.
 
Marshal
Posts: 60168
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to servlets forum
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!