JSP Buffering and Error Pages
Sometimes when a JSP page errors out it doesn't redirect to thespecified error page but displays the error page inline. In that case the page buffer has most likely been filled and because data has already been sent to the browser and the server cannot send a redirect command.
In these cases increase your JSP page buffer size with the page directive's buffer attribute. The default is 8kb. Increase it to something that your page will most likely not fill.
<%@ page buffer="50kb" %>