• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

newbie in jsp

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello guys i hope you can help me in here....when should i use the get method or the post method? I already know their meanings etc i just want to ask for some realistic examples especially for those who have already developed many web applications. Thanks....
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is really an HTTP question. In simple terms, POST is good for passing reasonably large amounts of data, whereas GET is not.
GET sticks all your data on the URL, so some people like to use POST for aesthetics.
If I remember rightly from the HTTP spec, GET is supposed to be a request for data (hyperlinks basicly) whereas POST is intended for sending data upstream.
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two more suggestions:
First: You should never use GET if there is any sensible form data (like passowrds etc) to be transferred, cause the data is attached to the URL and will propably be cached by proxies or browser cache. This makes it very easy to spy them out.
Don't get me wrong - POST is not an appropriate method to hide sensible information (You need to have some sort of encryption between Browser and Server for this - like SSL) but it is at least a solution to avoid the Problem explained above.
Second: GET has the advantage that form-submissions can be simulated with a link. Like if you want to show somebody the result of a search submission in Google you can give the complete search-URL to somebody. Like this:
http://www.google.de/search?q=GET+POST+Method&hl=en&lr=&ie=UTF-8&output=search
cheers
Hartmut
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually, use POST if the user is sending information which will be stored on the server, or if the information will be used to update information which is already stored on the server.
Use GET for navigating, such as to display an existing record on the server.
POST must be used if you are submitting a lot of information, because of the maximum size of a URL (I think its 4K characters).
GET has the additional advantage that you can bookmark the resulting address, and use it as a target in a hyperlink. For example, this discussion board arranges to show messages through a GET request. That way, you can bookmark the individual messages, and give links in one message which refer to another message.
 
Hartmut Ludwig
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Zalewski:
POST must be used if you are submitting a lot of information, because of the maximum size of a URL (I think its 4K characters).


According to RFC 2068 there is no maximum length limit for a URL defined in the HTTP protocol. It is just some Proxys that cut off URLs which are longer than 4K. Some old browsers even support only URLs up to a maximum length of 255 chars.
So to avoid those limitations it is highly recommended that a GET request with all parameters is not longer than 255 chars, while for POST-requests there is virtually no limit at all.
sl
Hartmut
[ September 07, 2002: Message edited by: Hartmut Ludwig ]
[ September 07, 2002: Message edited by: Hartmut Ludwig ]
 
Normally trees don't drive trucks. Does this tiny ad have a license?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic