This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Struts and the fly likes Refresh Page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Refresh Page" Watch "Refresh Page" New topic
Author

Refresh Page

Mahi Ranga
Ranch Hand

Joined: Jan 27, 2011
Posts: 33
When Submit a Form and while submit is working ,press the Refresh , what will happen in Struts ?
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 446

Mahi Ranga wrote:When Submit a Form and while submit is working ,press the Refresh , what will happen in Struts ?


1) Depends upon browser
2) Usually re-submits the request
3) Check on Google
4) Try yourself to see various scenarios
Mahi Ranga
Ranch Hand

Joined: Jan 27, 2011
Posts: 33
When Submit a Form and while submit is working ,press the Refresh , that it will go same request and insert duplicate records,but i want validation of button.
Jaimesh M Ponkia
Greenhorn

Joined: Nov 24, 2010
Posts: 21
In your case, if the request is inserting some data and you want to prevent duplicate insertion then implement the validate method in your action form and verify if the data is already present in the db.
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 446

Or better use Post/Redirect/Get Design pattern
Mahi Ranga
Ranch Hand

Joined: Jan 27, 2011
Posts: 33
I heard Tokens for applying to buttons.can you please explain Tokens.
srinivas dj
Greenhorn

Joined: Feb 08, 2011
Posts: 1
hi Ranga,
preventing dublicate form submission you need to configure token interceptor. please read the insturctions in below url.


struts2tokeninterceptor
Mahi Ranga
Ranch Hand

Joined: Jan 27, 2011
Posts: 33
Hi Sir,
thanks for reply,but by Using tokens(isValidateToken()) method we can resolve that problem,but i want sample example.Please provide sample example.
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 446

Hope you could have taken the trouble to search "Duplicate Form Submissions" on Google.

Here are the first two results..

http://www.netmechanic.com/news/vol5/html_no16.htm

http://www.coderanch.com/t/51602/Struts/Duplicate-form-submission-Synchronizer-Token
Mahi Ranga
Ranch Hand

Joined: Jan 27, 2011
Posts: 33
Thank you very much sir.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refresh Page
 
Similar Threads
JARS are visible threrough RAD 7.0
Differentiate between refresh/submit actions in servlet
Request Dispatcher Scrolls HTML Frame!
VERY STRANGE SUBMIT BEHAVIOR!
Upload attachment to QC [Quality Center] using java