Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

How to send multiple pages to same browser

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JSP that has a form that submits to a servlet to read a file and then return the value of the file in a bean back to the JSP. I want to be able to send "update" pages to the browser so the client knows the progress of the read. Is there any way I can do a sendRedirect() to the page with a value in the bean telling how much has been read and then keep sending updates every few seconds until the file is read? I know some people do this to show the status of a site search but it looks to me like they send the page with an instant refresh back to the servlet. This won't work for me since the servlet is in the middle of reading a file on another server so I don't want the servlet thread to end until the entire file is read. I have tried coding multiple sendRedirects in the read code but the only thing the browser displays is the last value before the servlet returns. If anybody has any ideas I would appreciate it.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you cannot do this with a jsp architecture. But you can if you use a servlet that creates your html.
Use the out command on the servlet and you can send HTML to
the browser.
example:
out.print("<HTML>");out.print("<BODY>");
out.print("<H1> processing started </H1>");
out.flush();
// do some processing
out.print("<H1> processing ended</H1>");
 
reply
    Bookmark Topic Watch Topic
  • New Topic