Remember, there is only one stream going to the browser, and the browser is
only expecting one document per connection. HTML wasn't designed for that
type of communication. You probably want to use the meta tag that asks the
browser to resubmit it's request after a few seconds (I can't remember which
one, but you should be able to find it on the list). That way, the user's
browser will get the "Please wait..." with a request to resubmit it's
request in 10 seconds. It will then generate a separate document containing
"Finished" on the subsequent request. The key is one document per request.
(*Chris*)
----- Original Message -----
From: Joona Palaste <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 26, 1999 6:55 AM
Subject: PrintWriter flush() with HTML/WML?
> Several people on this list have mentioned the method flush() of the
> PrintWriter belonging to a HttpServlet's HttpResponse. This seems to work
> right
> only on plain text files, not markup languages like HTML or WML (Wireless
> Markup Language).
> Suppose I have this kind of code in my servlet's doGet() method...
>
> out.println("Please wait...");
> out.flush();
> long t=System.currentTimeMillis();
> while (System.currentTimeMillis()<t+10000); // wait 10 seconds
> out.println("Finished.");
> out.close();
>
> If I have set the content-type to text/plain, it works like it should, the
> text
> "Please wait..." arrives right away and after 10 seconds, the text
"Finished."
> arrives. However, if I change the content-type to text/html, the browser
just
> waits 10 seconds, and then both lines arrive. It is the same with WML. As
the
> services I'm developing need markup languages, not plain text, I need some
way
> to output HTML or WML content with the flush() method, or a similar
method. Is
> there any way to do this?
>
> Joona Palaste
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html