• 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

errorPage doesn't got to new page

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JSP page that has an error page defined. This works, however depending upon where the error occurs in the jsp page all of the page up to the point of the error is also displayed. If I induce an error at the top of the page just the error page is visible. If I induce an error somewhere later in the page say in a table cell the contents of the error page appears here with the rest of the page. It is as if the error page is an include.
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you submit some code as well?
 
Bruno Collins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Error page looks like this:
<%@ page contentType="text/html" %>
<%@ page isErrorPage="true" %>
<html>
<link rel="stylesheet" type="text/css" href="../monstyle.css">
<h1>Sorry! an error has occured.</h1>
<blockquote>
Error message:<%= exception.getMessage() %><br>
Java exception:<%= exception.toString() %><br>
JSP requested:<%=request.getServerName()+request.getRequestURI() %><br>
</blockquote>
<% System.out.println("jsp_error_page: Error in JSP: " + request.getServerName()
+ request.getRequestURI() + ". Exception was: "+exception.toString()); %>
<h2>Please contact support.</h2>
</html>
Page creating the error:
<%@ page contentType="text/html" %>
<%@ page errorPage="/MonError.jsp" %>
<%@ page import="java.util.*" %>
<html>
<link rel="stylesheet" type="text/css" href="../monstyle.css">
<body>
<h2>Group List</h2>
<table cellpadding="0" cellspacing="0">
<tr>
<th>Group Code</th>
<th>Group Description</th>
<th>Edit</th>
<th>Delete</th>
<th>Copy</th>
</tr>
<jsp:useBean id="mglb" scope="request" class="com.primur.monitor.MonGroupListBean"/>
<%
String rowStyle = "tr1";
Vector grouplist = (Vector)request.getAttribute("grouplist") ;
for (Enumeration e = grouplist.elements() ; e.hasMoreElements() {
mglb =(com.primur.monitor.MonGroupListBean)e.nextElement();
%>
<tr class="<%=rowStyle %>">
<td> <a title="View" href="MonGroupMaint?mode=view&id=<%= mglb.getGrgrpc() %>">
<%= mglb.getGrgrpc() %></td>
<td><%= mglb.getGrdesc() %></td>
<td>
<p align="center">
<a href="MonGroupMaint?mode=edit&id=<%= mglb.getGrgrpc() %>">
<img border="0" src="../edt.gif" width="22" height="20" alt="Edit"></a></td>
<td>
<p align="center">
<a href="MonGroupMaint?mode=delete&id=<%= mglb.getGrgrpc() %>">
<img border="0" src="../del.gif" width="22" height="20" alt="Delete"></a></td>
<td>
<p align="center">
<a href="MonGroupMaint?mode=copy&id=<%= mglb.getGrgrpc() %>">
<img border="0" src="../cpy.gif" width="22" height="20" alt="Copy"></a></td>
</tr>
<%
if (rowStyle=="tr1"){
rowStyle = "tr2";
}
else {
rowStyle = "tr1";
}
}
<%
if (true)
throw new Exception("This is my test"); // test error page
%>
%>
</table>
<p></p>
<a href="MonGroupMaint?mode=add">Add New User</a>
</body>
<html>
The error page appears in a cell of the page's table.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is because at least one bufferload has already been flushed when the error occurs. You might try increasing the buffer size in the page directive.
Bill
 
Bruno Collins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks I will give it a try.
 
reply
    Bookmark Topic Watch Topic
  • New Topic