This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with jsp:include

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • 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 ??
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic