• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is this needed? --- pageContext.getOut().flush()  RSS feed

 
scott p laplante
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've seen many example tag classes that have pageContext.getOut().flush();, wrapped in a try/catch, as the first line of doEndTag().
1. What is the purpose of that?
2. From the docs at JspWriter.flush() it seems that this call would forward the flush onto the Response. Would this disallow a tag error from redirecting the user to the error page? (Response.flushBuffer() commits the status and headers, disallowing future redirects in the page, right?)
3. What bad things happen if you don't flush it?

If there is a good explanation of any of this, I'd love to be pointed to some good docs.
Thanks!
[ May 12, 2004: Message edited by: scott p laplante ]
 
scott p laplante
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've found other examples of this, but cannot find any documentation as to why one would want to do this. any ideas?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) It will cause the output buffer to flush prior to processing the rest of the end tag handler (which is usually what emits any output of the tag in non-body tags).
2) Yes, once committed, headers cannot be written so no redirects are allowed.
3) Can't think of any.
Body tags are different since they have their own buffers... but that, as they say, is another show.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!