Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Avoide double submit  RSS feed

 
Anup Srivastava
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to add some data i forward my page to a servlet which calls a bean to add new entry and finally servlet fwd it to next page. If on entering on next page user refreshes page then a duplicate entry is made to database. How Can i avoid it? i tried to implement the method (saveToken(request)) of Struts but all went in vain. How can i do it???
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After processing, use a response.sendRedirect() to the nest page. This will cause the user to load the page from a new request, and refreshing the page will reload the page, not resubmit the data.

Dave
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this great article on Redirect After Post for more details on David's suggestion.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Double Submit Problem is discussed in JSP Faqs. Please check out the faqs prior to post the question.

Thanks.
[ January 22, 2006: Message edited by: Adeel Ansari ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!