• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Avoid submitting JSP twice

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can anyone let me know complete end-to end implementation of above functionality?

I want to implement this with isToken() and saveToken() methods.
regards,
Shailesh
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this thread:

https://coderanch.com/t/48839/Struts/Preventing-multiple-posts
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I remember -- if use will open multiple windows which will use Struts's saveToken/* -- it will not work. For this purpose I have my own implementation of this functionality. :-)

So, in case if you will need "multiple windows opened", you probably will need to take care about creating your own implementation, too. It's very easy. ;-)
 
Shailesh Patel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your responses.

I have tried implementing points suggested in referred thread. The problem is isValidToken(request) method. This returns 'false' always.

I have done following steps:

1. saveToken(request) in initiating action class. This is child of Action class.
2. check with isValidToken(request) method for correctness of this token.

I am using three screes in IFrames in one browser screen

Any pointers..

regards,
Shailesh
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see that anyone mentioned disabling the submit button using javascript.

Tokens are great (especially where the user hits the back button and does a page reload), but if the user hits that button twice the second submit fails. You don't get a chance to tell them that the first one worked.

I was doing a netmeeting with a user that was having problems with something and I watched him hit that submit button again before I could say anything. (nooooooooooooo).
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Carol Enderlin:
I don't see that anyone mentioned disabling the submit button using javascript.



Using JavaScript to disable the submit button is fine if used in conjunction with tokens. I wouldn't rely solely on JavaScript though.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shailesh Patel:
Thanks for your responses.

I have tried implementing points suggested in referred thread. The problem is isValidToken(request) method. This returns 'false' always.

I have done following steps:

1. saveToken(request) in initiating action class. This is child of Action class.
2. check with isValidToken(request) method for correctness of this token.

I am using three screes in IFrames in one browser screen

Any pointers..

regards,
Shailesh



View the source of the html from your browser. There should be a input tag of type hidden just below the form tag.

If it isn't there, make sure you are using html:form in your jsp.
 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly what I meant to say:

Originally posted by Junilu Lacar:


Using JavaScript to disable the submit button is fine if used in conjunction with tokens. I wouldn't rely solely on JavaScript though.

 
bas duijzings
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe a bit late, but in addition to my earlier posting,

http://www.theserverside.com/news/thread.tss?thread_id=26247

(and thank lasse for linking in some other question)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic