• Post Reply Bookmark Topic Watch Topic
  • New Topic

communication between server and open JSP page

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am uploading files to the server and storing them into the database. The user does this by going to the upload.JSP. As each file that is uploaded is processed I would like to show the client (upload.jsp) the name of the file that has been processed. This way they will not sit there waitng and maybe thinking nothing is happening. How can I update the client page(upload.jsp) without the user having to do anything?
Is this possible?
Thank you
david
 
Akshay Sharma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use javascript to open a small window which will reflect teh status as uploading till the file actually goes in there
 
Simon Harvey
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,
I think this depends on whether you are wanting to upload more than one file per page. So that the jsp has to change its state multiple times to display a message on each message as it comes to it. That makes things difficulat and I'm not to sure what you could do short of somehow poling your server for an update on the work thats being done. You might also consider making a small application or applet that can handle this sort of thing better.
The reason why its tricky is because of the nature of web apps. Because its based on client/server or request/response, there isn't any easy way to have the server contact an open jsp page (hence why i suggested poling the server for updates)
I don't know about the previous posters idea - he could very well have just what you need, but would it not be simpler to just say to the user that this might take a few minutes and not to try and refresh the screen?
Alternatively, and this is what i would probably do is, warn the user that the operation might take a few minutes and at say after 30 seconds, contact the server for an update. The idea is to not keep pestering the server to much but also to let the user know whats going on.
Of course, if the upload completes inbetween a 30 second "refreshpoint" then the javabean or whatever thats actually doing the processing should just forward the user to a success page rather than hanging about for the next refresh.
I'd either do it that way or make a simple applet
Good luck
Simon
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!