This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp wont display until loop has completed

 
Chris Garrison
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I know this forum is free, but does the attitude cost extra?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic