Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling double click on submit

 
Maurice Maeterlinck
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I�ve been working on handling multiple submits with saveToken(request) and isTokenValid(request) , but I have a problem with returning forwards.

I�ve made some artificial action just for testing. These are the actions:


ShowCheckTokenAction.java : just saves the token

saveToken(request);
forward = mapping.findForward("success");


CheckTokenAction.java : verifies the token and processes the business logic.

if ( isTokenValid(request) ) {
// reset the token
resetToken(request);

// business logic
Thread.sleep(5000);

return mapping.findForward("success");

} else {
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("notValidToken"));
saveErrors(request, errors);
return mapping.getInputForward();
}

notValidToken error displays something like this �action in process, wait-

When user submits the first request isTokenValid(request) returns true then the business logic starts, if user submit the second request before the first action is completed the isTokenValid(request) returns false and the action is forwarded to input page and displays and error. When the first request is totally processed, it returns to a success page, but this doesn�t happen, the browser stays in the input page with the error.

Does anybody know how to forward the first request?

Thanks in advance for any comments.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic