Hi All,
I am now working on a progress bar work.
The requirement is when the file transfer will start(as of now assume transferring taking place in the Hard Disk, from a drive to another),the amount of data that will be transferred will be shown in percentage/Kb in a progress Bar.

I use jsp+javascript+ajax--view
servlet class for handle the file write to destination folder.

The approach i have followed is

in Myjsp.jsp

<script>
2) copyFile()
{

//request send from here
//Ajax code......
3) //request has sent to servlet file

//response

// checkdata()
{
////destination file is mapped.the size is checked.And showing in the progress bar by a calculation
//progress bar code here
//

}

7) //jsp file got the msg here (to start checking the amount of data exist in the destination file)
7.1) //call a method so that in regular interval checkdata() will be called.
//And once file transfer finished progress, bar show msg as "complete" & disappear.
(to work in regular interval setInterval(checkData(),100) is called.)


</script>
<body>
//)file button(select the file u want to copy to the destination path)
//) text field(to fill the destination path)
1 //) copy button(mind it that it is a Button not a Submit btn) its onlick= copyFile()
//<div>
//progressBar code here
</body>
---------------------end of jsp file----------------------

Myservlet.java

4) // request come from jsp
//check for source file
5) //create a file with the same name in the destination folder(as of now it is empty)
6) //send a msg to jsp file (to start checking how much amount of data exist in the destination file) through ajax.
6.1) //call a function written for file copy.
//once filecopy complete give a msg on console that file "copying has ben complete"

-------------the end of java file----------------------------


here everything is working fine.div showing how much data is currently in the file
what is the problem is that
the when i start copying the file, upto 6.1) is working fine.Then progress bar showing directly "complte" as msg

Then if i again press the copybutton in jsp then the progress bar properly showing the ammount of data in proper intervaland increase properly.At this time the file is fully in the destination folder.But i have checked from the dest.. folder that again the size of file start to increse from 0 kb.

So do send msg for this problem