hi...
thanks for reply whatsoever... I try explain my side with this example...
Suppose I use doPost() in my form... and on click of submit button the form does some updates/transaction in the database server. Now if I again click the submit button, because for somke reasons I didn't get confirmation page... , the update / transaction will be commited again.
Am I right ... ?
Now my query is how do I escape from this disastrous happening... ?
I hope I am able to explain my side more clear... hope you will now understand what I am saying and what I want help on ?
PseudocodedoPost(request, response) {
// Do your thing to process the request.
// When the processing is finished, then do
response.sendRedirect("confirmationpage.jsp");
}
I use two approaches:
1. transaction id, when I display page I put unique transaction id on it in a hidden field. For every submit I check if there was transaction with such id finished or in progress and discard.
2. disable submit button in JS and then process submit (this method less robust but easy to develop).
Wow I almost 10 years with this forum.
hi..
thanks for reply... I liked your solution...
But if you don't mind, since I am very new to programming & Java, can you elaborate the solutions you provided... I mean in terms of some codes...? Like when to define/ allocate transaction id, how and where to define it .... when and where to check and what to do if it already exists... ?
Second disabeling submit button how .. when... till when .. and when to enable it again ?
Waiting for reply asap.
Form transactional submission is a standard feture of servlet framework we use. So generally extraction of code snippet can be difficult for me. I'd recommend to try Javaranch forum. Those guys may have some code solutions ready for sharing.
For JS it may look like:
document.myform.onsubmit=function() {
myform.submitbutton.enabled=false;
return true;
}
You may consult with JS developer though, because I do not do actual development.