Question : How to show the progress of record submission to the database dynamically in JSP

I have an application in which I've records like cust_id,doc_name,email_id in a text file. The application would read each line from the text file, submit the details to the database and send the corresponding document to the customer in the mail id specified. What I need is, I want to display in the jsp the progress of the record submission one by one like,

Record for cust-id submitted and mail sent successfully

If there are n no of records in the text file, I need to show in the jsp the progress for all the n records one by one as mentioned above. can this be achieved by Ajax or something more is required. Pls help.

Answer : How to show the progress of record submission to the database dynamically in JSP

I understood what you want. If you don't want to refresh the page every time record is processed you need Ajax. But it is not possible to show processed records one by one, because you have to send requests to the server one by one. It means that you have to have all of the parameters like JS variables in order to be able to send them to the servlet(your ajax servlet).
Other solution is to call the servlet through a function with timeout (see my link above) and the server should return to you xml with customer id's processed in the meantime.
After that add each one of those records in a table throught JS :
for (i=0; i < custIdArray.length; i++) {
oTR = tblDocs.insertRow();
oTD = oTR.insertCell(0);
oTD.innerHTML = 'Record for ' + custIdArray[i] + ' submitted and mail sent successfully';
}
Random Solutions  
 
programming4us programming4us