This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I created a servlet that performs insertion of records and sometimes the amount of records to insert can be huge in about 4000 or maybe more records. After all the insert function has completed I redirect back to the existing jsp page where the insert is performed. The problem is that after for some time, it is unable to redirect back and display 'the page cannot be displayed' page. I read before that this happens if the page still cannot be displayed for a period of time because the browser assume that the host cannot be contacted. If this is true how can I overcome this. I have tested before and this happens if the time taken to create the records is over 2 minutes. Thanks
Is it paramount that the client is shown the page only AFTER the insertion is complete, or is it acceptable that the insertion is only started before the redirect? If the latter, you could use an asynchronous mechanism to do the inserts. For example, the inserts might be done by a separate thread which is started just before you redirect back to the JSP. To give confirmation of success, that thread might then for example send an email confirmation (just like online stores do for creditcard processing which also typically can take a while). If the JSP is to give results based on some calculation done on the data after it is inserted this is of course not feasible and your only option will be to find a means to seriously improve your database performance.
Joined: Nov 20, 2003
Actually the insertion of data is done in a loop manner. Only then it is redirected back. The redirection to the page is for display some message stating whether all the records are successfuly inserted or not. If not successful then an error message is displayed. So therefore I need to perform all the insert records completely to determine whether it is successful or not. Then a parameter is passed together with the redirection link to a jsp page to determine which message to display. Hope my problem's explanation is clear.