File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Idempotent. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Idempotent." Watch "Idempotent." New topic
Author

Idempotent.

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

can't we change the state of an object if the method is get.Please somebody clarify.


Neeraj.
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Just to add more..

wats the best way to avoid users hitting submit twice when method is post ?

Neeraj.
Kai Witte
Ranch Hand

Joined: Jul 17, 2004
Posts: 356
hello,

Originally posted by Neeraj Vij:
can't we change the state of an object if the method is get.Please somebody clarify.


we can, but for GETs we SHOULD not change anything on the server. It's really just "should". Technically we could implement doGet in a non-idempotent way.

Conan
[ September 30, 2004: Message edited by: Conan Elvitaro ]

Kai Witte's business website Kai Witte's private homepage
Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
Greetings from Hogwarts,

Don't know if this is what you asked for but just disable the submit button after one click (javascript)

Brian
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Yep, I agree with Brian that JavaScript can prevent users from double submission.

If I'm not mistaken, Struts also had this capability of detecting double submission. Read this somewhere on the Struts page.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

Don't know if this is what you asked for


I want to avoid side effects of post method, when the user clicks submit button twice.

rgds,
Neeraj.
Ramnathan Ravindran
Ranch Hand

Joined: May 12, 2004
Posts: 46
Hi Neeraj,
To add to what Brian has said, Javascript can used to prevent the double submission by a user. Actually I have that script logic here in my web application. I did answer your second question.
For the first one, whatever be the case the GET method is idempotent. It is we who have to make sure we dont override the doGet() to be a non-idempotent. It is not a rule but it would be better if we adhere to the objective of the Http Methods.


Regards<br />- Ramnathan<br />SCJP 1.4, SCBCD 1.3, OCA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Idempotent.