Paolo,

There seems to be a lot of discussion on this topic.  The real problem seems
to be the fact that you need to control too many things to get it to work.
Firstly, you need tell your JSP to flush (which isn't the difficult bit),
then you have to find a web server that doesn't buffer content from
wrappers, and then you have to somehow make the client browser do the same
thing.

Even if you can figure out how to do the first two parts, controlling
browser behaviour is impossible, and any code you might want to write to
prevent buffering on the client side will probably be seen as some sort of
security breach by IE and Netscape.

It seems the only way to ensure the content is seen while your lengthy JSP
executes is to have a frames page, with perhaps a status bar type frame
somewhere that gets updated with "Working..." or something similar.  You
would have to use JavaScript (or similar) for this.  E.G. (the code should
be fairly self explanatory, so excuse the lack of comments) :

FRAMES.JSP

<html>
<head>
    <title>Some Application</title>
</head>

<frameset rows="*, 50">
    <frame name="frameMain" src="page1.jsp">
    <frame name="frameStatus" src="status.jsp">
</frameset>
</html>


STATUS.JSP

<html>
<head>
    <title>Status Bar</title>
</head>

<body>
<span id="statusText"></span>
</body>
</html>


PAGE1.JSP
<html>
<head>
    <title>Form Page</title>
</head>

<body>
<form action="page2.jsp" method="POST"
onsubmit="frameStatus.statusText.innerText='Working... Please Wait';">
    <input type="text" name="textbox" value="">
    <input type="submit" value="Submit">
</form>
</body>
</html>

PAGE2.JSP

<html>
<head>
        <title>Working Page</title>
</head>

<body>
    <!-- place all your JSP code here -->

    <!-- Finished the lengthy code, so tell the browser to update the status
bar frame-->
    <script language="JavaScript">
        frameStatus.statusText.innerText = "Complete!";
    </script>
</body>
</html>


-----Original Message-----
From: Paolo Miotti [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 04, 1999 4:03 AM
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Subject: How to flush the content of a page...



Hi everybody,

how can I flush the content of a JSP page, while I'm waiting the page
completes ?
I try to explain better:
a page use a Bean to do a "time consuming" task, so I'd like to notify the
user that
a task is completing, something like

"we are processing your request, please wait..."

when the Bean finished its task, the user will see the whole page !
I need to flush the page (to send the page to the browser) just before call
the Bean's method.

Thanks in advance, Paolo.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to