This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Get and Post Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Get and Post Method" Watch "Get and Post Method" New topic
Author

Get and Post Method

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi
Help me out. What is the basic difference between Get and Post method apart from following two :
(1) In Get method, we can attach Query String and URL can be bookmarked. Here, we can pass limited data.
(2) In the Post method, we can pass any amount of Data.
I was asked to tell five difference apart from these two.
Thanks.
Rakesh
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Here are some
1. GET method retrieve data by SQL queries POST to update data.
2. POST you can use Streams.
3. GET restricts based on URL length wheras these are not there in POST.
4. In POST data is hidden from user whereas in GET the URL is visible.
These are some that i know. Hope i am able to add to knowledge.
Bye
SimpleSteps
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Dear SimpleSteps
Whatever we use GET method, It limits the URL length and In the Post, We can send any amount of data. So, I think, third and fourth point given by you is ok short of. Any way thanks for that.
Rakesh
Naveen Chandra
Greenhorn

Joined: Feb 08, 2000
Posts: 12
Hi Guys,
By the way what is the maximum length of the URL that one
can generate and send across the web.
Thanks in advance,
Naveen.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
IMHO About 250 characters
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

IMO, (one of my friends said this, really)
the limitation on URL is 1 kb (whatever that means).
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

hmmm.....5 differences....here goes my attempt
doPost:

  • Called by the server (via the service method) to allow a servlet to handle a POST request.
  • POST method allows the client to send data of unlimited length to the Web server a single time
  • useful when posting secure data (like credit card numbers)
  • This method does not need to be either safe or idempotent.
  • Operations requested through POST can have side effects for
    which the user can be held accountable, for example, updating
    stored data or buying items online.

  • doGet:

    • Called by the server (via the service method) to allow a
      servlet to handle a GET request.
    • Overriding this method to support a GET request also
      automatically supports an HTTP HEAD request.
    • The GET method should be safe, that is, without any side effects for which users are held responsible.For example, most form queries have no side effects.
    • If a client request is intended to change stored data, the
      request should use some other HTTP method.
    • The GET method should also be idempotent, meaning that it
      can be safely repeated.

    • so did you get the arithemetic right....
      I am not an expert in Servlets but definetly know where to look... ...
      You can find all this and much more at the J2EE API Specs
      enjoy.....
      Regds.
      - satya
Arathi Raj
Ranch Hand

Joined: Nov 22, 2002
Posts: 90
Hi

Operations requested through POST can have side effects for
which the user can be held accountable, for example, updating
stored data or buying items online.

Can anyone explain me this in detail. How Post will have side effects. when sendind date through this method is safe?

Also I want to know

GET method retrieve data by SQL queries POST to update data.
What does these mean. Explain this also.

Thanks
arathi
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Thanks for the reply, but this thread was 5 years old, there is no benefit in resurrecting it.

If you would like to ask a new question it is better to start a new thread, referring to another if desired.

Dave
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Oh, I see you did that too. Please don't do that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get and Post Method
 
Similar Threads
Passing huge string to JSP..
difference between save() and persist() method
Difference between Class.forName and ClassLoader
difference btw doGet and doPost methods?
query about GET and POST methods