SCJP 5.0 77%
Originally posted by Johnson Abraham:
You will have to associate your request object with a unique key and a boolean variable. You will also have to maintain a hashtable at the application scope which will keep a record of which unique key is associated with which request. Request object is a hash, so you can set and get objects on your will. So as soon as a request is submitted you need to get the unique key and request id from the request check in the application scopes hashtable to crosscheck if it is the correct key. If the authentication passes set the boolean variable to true. Now true will signify that this request is submitted. so everytime you will have to check for the boolean variable to see if the request is already submitted. If the request is already submitted do not perform any action.
Originally posted by Rahul Bhattacharjee:
Technically Johnson's suggestion can be implemented by the following way.
Client ckilks submit button.
Below is the algorithm that is to be implemented at the servlet code that intercepts the client request.
session = request.getSession(false);
if(session != null){
String firstClick = session.getAttribute("FIRST_CLICK");
if(firstClick.equals("SET")){
//this is second click of the button.
//take appropriate action.
}else{
session.setAttribute("FIRST_CLICK","SET");
//do processing.
}
}//end of if.
SCJP 5.0 77%
Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />[email protected]
She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.