• 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

Problems with jsp:include

 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys. I have been using my web application with this include:
<jsp:include page="/leftNavigation.jsp" flush="true"/>
but now I'm getting this strange error:
java.io.IOException: Error: Attempt to clear a buffer that's already been flushed.
So, What I did was to increase the buffer size to 14kb:
<%@ page buffer="14kb"%>
and instead of using <jsp:include>, now I'm using
<%@ include file="/leftNavigation.jsp"%>
but the problem persists... any ideas ??
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The preferred solution is to find the problem and fix it. Increasing buffer sizes is merely a work around (IMO etc)
From my experience this problem is usually caused by an exception being thrown after the buffer has filled. If you keep the JSP code small and stable (MVC etc) it reduces this. If you can find the exception you can manage it and stop the problem occuring.
(careful use of terminolgy: note that I didn't say 'handle' it. I'm not necessarily saying you should just put a try/catch around it)
It also helps to get any scriptlet coding that might throw an exception done first.
Not necessarily immediately useful, but I hope this helps.
Dave
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David.
The problem was that in my servlet I was generating a token and was putting it in the request. In the jsp page I was checking the request and if the token was not there I was forwarding the request again to the servlet, so the token could be generated.
But, I forgot that response.sendRedirect creates a new request, so I was losing my token...
anyway... thanks for the tip. no need to resize the buffer
 
"To do good, you actually have to do something." -- Yvon Chouinard
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic