Differences between using GET and POST as methods in FORM

A

Atirya Yodha

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">
</form>

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 ?

Thanks,
Atirya
 
J

Jukka K. Korpela

Atirya Yodha said:
But what technically is the difference here between
GET and POST ?

It's explained in HTML specifications, mostly. But you might wish to
use some more digested information:
http://www.cs.tut.fi/~jkorpela/forms/methods.html
<form action="welcome.html" method="post">
<input type="submit" value="Return">
</form>

on clicking on Return, I get an error :

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

It's rather self-explanatory, isn't it?
But when I change the method to GET , then I am able to go back
by clicking the Return button.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top