• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Idempotent.  RSS feed

 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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


Neeraj.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add more..

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

Neeraj.
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings from Hogwarts,

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

Brian
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!