File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Usage of GET and POST? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Usage of GET and POST?" Watch "Usage of GET and POST?" New topic

Usage of GET and POST?

Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 145
Regarding: book Head First Servlets & JSP, page 111, second paragraph.

1) What is meant by 'cannot be bookmarked'? I could as well just go to a form POST page and bookmark it, but then it wouldn't work because when I would visit it again, e.g. the form data would be gone.

2) "The users might want to come back a week later and try the same search again now that there's new data on the server". What does this mean? Does it mean that it woul be bad to allow a GET request on a search box? I see it as an advantage of not having to fill in the search terms again.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

1) Yes, bookmarking a POST is not all that useful. That's why a pattern like the PRG Pattern (described in this article) is preferred. That way, dangling POSTs are never left on the page for people to bookmark. It also prevents an annoying browser message when refreshing, or the accidentally replaying of destructive POST action.

2) I believe it's saying that bookmarking the GET with its complete URL is a good thing as it's easy for the user to "replay" the search at a later time.

[Asking smart questions] [About Bear] [Books by Bear]
Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 145
When you bookmark something, what is actually being bookmarked? Just the request line (GET - or are headers and the body bookmarked as well?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Only the URL.
I agree. Here's the link:
subject: Usage of GET and POST?
It's not a secret anymore!