• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction Problem

 
kiran mahavir
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
Please Suggest how to approach the following problem,
In an application(which is implemeted with JSPs and servlets) developed by me, the user has to fill up several pages with information to complete a task.The task gets executed when he finishes with the last page.That task is a bit complex(which involves accessing DB etc). After the task is completed the application responds with a thank you message.
Now my problem is, if the user submits the last page several times(slow response due drop in net speed or something like that) before the task is completed,the task is redone that many times.
How to overcome this repeatetive execution.If the task is still in execution, the application should ignore the request instead of redoing it.
Thanx in advance
Regards
Kiran
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good news. You are not the first, who encountered this problem.
It is mentioned for example in the J2EE-Design pattern books by sun.
Favoured solution by mainstream is the token solution: Dave Soto explained it quite well for my taste:
http://www.javaranch.com/ubb/Forum7/HTML/004412.html
(search for token in this forum, and you will get some references among the most recent posts).
 
somepal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Iam not sure whether I understand correctly. But If the users submit the last page via a buttin(HTML) then u can disable after its hit once.. which will eventually avoid submitting the same again.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64622
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client-side solution proposed by somepal (be prepared to change your name) is less optimum than the token solution because it relies upon javascript that needs to be different in various browsers, and can't protect against a resumbit via refresh and the back button.
hth,
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic