This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to send multiple pages to same browser  RSS feed

 
Chris Behr
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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.
 
wells
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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>");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!