• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Which request is better Get or Post?

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please validate these scenarios for Get/Post:Some are taken fronm HFJS ,first chapter

1)User is returning a login name and a password---post
2)Requesting a new page via a hyperlink---get
3)Chat room user sends a written repsponse---post
4)User hits the next button to see the page---get/post ?
5)user hits a logout button on secure banking site---post
6)User hits a back button on the browser---get
7)User sends a name and address form to the server---post
8)User makes a radio button selection---get/post?
9)User refreshes the page from the broswer refresh--get/post?
10)user types a url in broser and hits enter-get

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems they are ok.
Usually you should use POST when you are handling big quantity of data (GET is very limited) or there are data that you don't want to be seen (security sensitive, personal information, etc). GET is faster.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

4)User hits the next button to see the page---get/post ?


GET seems reasonable, but POST is certainly a possibility.

6)User hits a back button on the browser---get


The browser may retrieve the page from the cache without accessing the server again. If the browser chooses to get the page from the server, then whatever was used to get it before will be used.

8)User makes a radio button selection---get/post?


A form submission will generally be done using a POST.

9)User refreshes the page from the broswer refresh--get/post?


Whatever was used to retrieve the page in the first place will be used.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just read the same questions in the chapter and the one which I wasn't sure about was:

8) User makes a radio button selection



Selecting the radio button itself does not cause a form submission so if I saw this in an exam, I would be concerned it was a trick question (although yes, technically there are no trick questions).

If worded as:

8) User makes a radio button selection then submits the form/page


Then a GET or POST method could be used. A POST is likely to be the most appropriate.

 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic