• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Flushing Output Stream (s2)

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Struts action which iterates through a large List of data and displays it on a JSP page. The resulting HTML file is almost 500 KBs. If the user stops loading the page or clicks another link before the page has loaded, thousands of "Error Flushing Output Stream" exceptions are thrown on my error log console. Apparently Struts 2 continues trying to flush the output even after the connection is closed by the client. Is there any way to stop Struts 2 from flushing the output stream after it encounters a failure? If I let the page load without interrupting it, I receive zero exceptions and everything works fine.

I tried adding the following line to the front of my JSP page, but it didn't help:

<%@ page language="java" buffer="500kb" autoFlush="false" %>

Any other suggestions? (Note that I don't have the option of breaking up the data into smaller pages.....)
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you iterating through the data?
It sounds like you are catching and reporting the exception inside the iteration. What you should do is interrupt the iteration once you get an exception.
 
David Zazeky
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm actually not catching the error at all. Here is my JSP page code:



How would I add error code to catch the exception? The specific exception being thrown is a:

java.io.IOException: Error flushing the output stream

Thanks!!
[ November 05, 2008: Message edited by: David Zazeky ]
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I was afraid of.
My gut reaction is to add try-catch scriptlets around the property tags and try to call break (who knows if that would stop an iterate tag) if you get an exception.
Maybe someone else will have a better idea.
By the way, it's a good idea to give us a heads up when you have posted the same question elsewhere, like the Struts user list. That way if you never came back and got a good answer, later users searching for the same could follow your link over there.
BeForthrightWhenCrossPostingToOtherSites
 
Yup, yup, yup. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic