• Post Reply Bookmark Topic Watch Topic
  • New Topic

Waiting screen : How -to ?  RSS feed

Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have following problem:
1) A user clicks on a button to call a servlet that will generate a .pdf document.
2) In the mean time a window is opened that displays a waiting message.
3) When the .pdf document is ready the 'waiting' window should be closed and a new window should be opened where the .pdf is displayed.
Now, after spending a day on this issue I have following:
1) On a form I have a small Javascript that opens a new window and calls the servlet (window.open(http://server/servlet/testservlet, windowname)
2) The servlet sends the waiting message to this window . In the mean time a separate thread is started to generate the pdf.
3) This waiting window checks every three seconds if the thread is ready (using: response.setHeader("Refresh", "3");
Now the problem I have is that:
1) When the .pdf is ready the servlet should close the waiting window, open another window and send the .pdf document to it.
The probmem is that I need to set two response.setContentType , once text/html to close the first window and open another (?) and once application/pdf to send the pdf

Anyone any idea ?

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!