• 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

Transaction Problem

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
permaculture is largely about replacing oil with people. And one tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic