Hi, there is a flush attribute in page directive. i would like to know what is the use of that attribute? what difference does that make to the jsp page? any real time application scenarios where it is used? thanks, Ram Dhan Yadav K
Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Lemme try in my words. When the buffer is filled with the specified amount of data, flush is used to clear the buffer and load new data in the same buffer (volatile space) from the same source, so if you have 20kb to pass and set buffer size to 8kb ans set "flush = true" in a JSP page, your 20kb data will be transmitted to the input/output stream chain like (8+8+4)kb to increase performance of the whole transmission. Correct me if i m wrong.
Ashik Uzzaman Senior Member of Technical Staff,
Salesforce.com, San Francisco, CA, USA.
Ram Dhan Yadav K
Ranch Hand
Joined: Aug 13, 2001
Posts: 321
posted
0
Hi Guys, I guess i found one usage of flush. Well, let me try to put it in code. <%@ page ...news paper..%> <%jsp:include page="article 1" flush="true"%> <%jsp:include page="article 2" flush="true"%> <%jsp:include page="article 3" flush="true"%> <%jsp:include page="article 4" flush="true"%> <%jsp:include page="article 5" flush="true"%> Here i am trying to put a rough sketch of a news paper. When i have to include "article 1", the buffer is flused and then it is included and then when i have to include "article 2", "article 1" is flused and thus client will be able to see the the "article 1" link(s) even while the "article 2" is bieng loaded. Does that sound realistinc. I guess so. ANy comments are welcome. thanks, Ramdhan Yadav K
Axel Janssen
Ranch Hand
Joined: Jan 08, 2001
Posts: 2164
posted
0
Yes Ramdhan. Think so. In my current perception the underlying PrintWriter Object is a buffered Stream. So 1. the characters are written to a buffer. 2. the content of the buffer will be written to the target of the Stream (browser of user) if a) the buffer is full b) the buffer is flushed with flush()-method. Any comments and corrections welcome. Axel
Axel, i agree with u... Ramadhan, have u tried a code using one of those articles (say article3) declaring flush="false"? I think that would be interesting how it behaves when it comes with next article...