Two Laptop Bag
The moose likes Struts and the fly likes Avoid submitting JSP twice Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Avoid submitting JSP twice" Watch "Avoid submitting JSP twice" New topic
Author

Avoid submitting JSP twice

Shailesh Patel
Greenhorn

Joined: Jan 26, 2005
Posts: 3
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
bas duijzings
Ranch Hand

Joined: Apr 07, 2004
Posts: 83
try this thread:

http://www.coderanch.com/t/48839/Struts/Preventing-multiple-posts


have a nice one
Olexiy Prokhorenko
Ranch Hand

Joined: Jul 11, 2004
Posts: 97
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. ;-)


<a href="http://www.BossTalks.com" target="_blank" rel="nofollow">http://www.BossTalks.com</a><br />Free advices and help for entrepreneurs: from Idea to IPO<br />Software and IT Project Management forum
Shailesh Patel
Greenhorn

Joined: Jan 26, 2005
Posts: 3
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
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1348
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).
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4134
    
    2

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.


Junilu - [How to Ask Questions] [How to Answer Questions] [MiH]
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1348
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

Joined: Apr 07, 2004
Posts: 83
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Avoid submitting JSP twice
 
Similar Threads
Story Time...
challenge in s/w field?
tricky!!!! tricky!!
Wimbedon
WA #1.....word association