EXTJS + JSP file upload with progress bar
2013-08-27 by seoer3
Source of demand is this: a largefile belt uploaded to server, server will parse this excel, then a one insertion into the database, the whole process should take a long time, so when the user clicks on the upload, you need to display a progress bar and according to the background of the amount of data received and processed timely progress update the progress bar.
Analysis: Background requires two components, uploadController.jsp used to receive and process the data, it will dynamically schedule information into the session, another component processController.jsp used to update the progress bar; when users click "Upload" after, form was submitted to the uploadController.jsp, while using js start a ajax request to processController.jsp, ajax progress percentage with access to update the progress bar displays the progress, and this process repeated once per second; this is the basic working principle of this case.
The question now is when the server receives data to know how the data received of the total number of data? If we start from scratch to write a file upload component, then this problem solved, the key is used many times we are mature components, such as apache commons fileupload; compare Fortunately, apache already thought of this problem, so the pre-left of the interface can be used to obtain the percentage of received data; therefore I use apache commons fileupload to receive upload files.
Analysis: Background requires two components, uploadController.jsp used to receive and process the data, it will dynamically schedule information into the session, another component processController.jsp used to update the progress bar; when users click "Upload" after, form was submitted to the uploadController.jsp, while using js start a ajax request to processController.jsp, ajax progress percentage with access to update the progress bar displays the progress, and this process repeated once per second; this is the basic working principle of this case.
The question now is when the server receives data to know how the data received of the total number of data? If we start from scratch to write a file upload component, then this problem solved, the key is used many times we are mature components, such as apache commons fileupload; compare Fortunately, apache already thought of this problem, so the pre-left of the interface can be used to obtain the percentage of received data; therefore I use apache commons fileupload to receive upload files.
keywords: file belt