File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes jsp:include in error page does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:include in error page does not work" Watch "jsp:include in error page does not work" New topic

jsp:include in error page does not work

sanker san
Ranch Hand

Joined: Dec 17, 2004
Posts: 56
I've a normal jsp page for which errorpage is set to error.jsp. The normal jsp page and error jsp page contains <jsp:include page="header.html" flush="true"/>. If an exception is thrown after the jsp:include statement in the normal jsp page, the error page is not displayed(only the header of normal page is displayed). Infact, it doesn't execute the statments after jsp:include in error page. However, if the exception occurs before <jsp:include, then the error page is displayed without any problems.
normal jsp page:-
<%@ page import="imported classes" errorPage="systemError.jsp" %>
<jsp:include page="header.html" flush="true"/>

error page:-
<%@ page import="imported classes" isErrorPage="true" %>
<jsp:include page="header.html" flush="true"/>

What is the solution to this pbm?
Vince Hon
Ranch Hand

Joined: Feb 11, 2003
Posts: 117
try this

<jsp:include page="header.html" flush="false"/>

Vince Hon<br /> <br />SCJP 1.4 | SCWCD | SCBCD <br /><a href="" target="_blank" rel="nofollow"></a>
Cecil Antony

Joined: May 13, 2005
Posts: 5
Hi Sanker,

<jsp:include>(action) is not the same as the <%@ include file="1.html">(directive)
<jsp:include> is a Run time Addition of page. Since the Error is executed @ the start of the page. There is no Execution or the flow to the rest of the page.

Try with <%@ include file="1.html">(directive).. This might suffice to your problem.

sanker san
Ranch Hand

Joined: Dec 17, 2004
Posts: 56
Hi Vince,
flush="false" doesn't work as it is giving compilation errors. looks like flush="true" is must atleast for older versions.

Hi Cecil,
It is true that the jsp:include in normal jsp shdn't work as there is an exception is thrown, but the jsp:include in error page shd work, right? As u said, <%@include file=""%> will work but it is not dynamic like jsp:include, right?
I agree. Here's the link:
subject: jsp:include in error page does not work
It's not a secret anymore!