Differences between using GET and POST as methods in FORM

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All,

I am relatively new to HTML. Just started using
FORMs in HTML. What is the difference between
using the GET method as the METHOD attribute of the
FORM tag from the POST method ?
I actually observed that whenever GET is used ,
with ACTION to some jsp :

In welcome.html :
  <FORM action="first.jsp" method="get">

then the URL is appended with the <key,value >
pair of the form element names and their values
as entered by the user while if I use :

   <FORM action="first.jsp" method="post">

then , the URL remains unchanged .

But what technically is the difference here between
GET and POST ?

Also in first.jsp , if i have something like :

<form action="welcome.html" method="post">
  <input type="submit" value="Return">

on clicking on Return, I get an error :

Method Not Allowed
The requested method POST is not allowed for the URL /welcome.html.

But when I change the method to GET , then I am able to go back
by clicking the Return button.

Why is this so ?


Re: Differences between using GET and POST as methods in FORM

Quoted text here. Click to load it

It's explained in HTML specifications, mostly. But you might wish to
use some more digested information:

Quoted text here. Click to load it

It's rather self-explanatory, isn't it?

Quoted text here. Click to load it

No, not back. What you have created that way is a worse than useless
duplication of the browser's Back button. It's worse than useless,
because it _appears to_ be a "back" or "return" button (as your
misconception indicates), but it isn't. It means going "forward" to a
page. You will notice this if you use your "return" button, then use
the real "back" button a few times in succession.

The welcome.html page is most probably (worse than) useless. Get rid of
it. Get to the point. Remember, from the moment that the user clicks on
a link to your page, you have about ten seconds (and that's optimistic)
to convince him that you have interesting content. A welcome page just
wastes half (or more) of those precious seconds.

Yucca, http://www.cs.tut.fi/~jkorpela /
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Site Timeline