• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp wont display until loop has completed

 
Ranch Hand
Posts: 44
  • 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 I want to display a "please wait while your query processes" message once a query is 'submitted.'
After displaying this (in the same .jsp), I want to loop like (pseudo code) :
while (queryStatus != finished){
sleep(a little while);
}
//once query is complete
<jsp:forward to results.jsp to see results>
The problem is: the page wont display until the loop completes (in other words, the "please wait ..." string never comes up. It does nothing until the queryStatus = finished - then if forwards to the result.jsp
Is this by design or am I doing something wrong? What can I do?
[ November 04, 2003: Message edited by: Chris Garrison11 ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course this won't work. The whole purpose of a JSP is to compose the HTML page to send to the client browser. By placing a wait in this page, you simply delay the sending of the HTML to the browser.
This very subject has been discussed on numerous occasions within this (and perhaps the Servlet) forum. A search should lead you to those previous discussions.
bear
 
Chris Garrison
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this forum is free, but does the attitude cost extra?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are reading attitude, you are reading wrong.
Perhaps a different approach: the way a JSP works is to buffer up some output to send to the browser. Any Java in the JSP runs on the server to build up this text buffer to send to the client. When the buffer is full, or the JSP is done executing, the output is sent to the browser. So if you put a wait in the page, you merely delay the building of the buffer.
If you haven't found what you are looking for after searching through the previous discussions on this topic, please feel free to ask further questions.
bear
 
reply
    Bookmark Topic Watch Topic
  • New Topic