Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include in error page does not work

 
sanker san
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this

<jsp:include page="header.html" flush="false"/>
 
Cecil Antony
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
Cecil.C.
 
sanker san
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic