You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Praki Prakash <pp...@arzoo.com> on 2000/06/23 02:39:34 UTC

forwarding to an error page in tomcat 3.1

Has anyone successfully used errorPage attribute of the page directive? The
following test jsp file always throws an IllegalStateException. Invoking
out.clear displays the error message but still does not forward to
error.jsp. Any insights into this are highly appreciated.

Thanks, Praki Prakash

<%@ page errorPage="error.jsp" buffer="256kb" autoFlush="false"%>
<html>
<body>
Test
<% if (true) { throw new Error("This is the error");} %>
</body>
</html>


Re: forwarding to an error page in tomcat 3.1

Posted by Praki Prakash <pp...@arzoo.com>.
It is version 3.1 running on an NT box. I figured out that if I throw an
exception object, it redirects to the error page. For Error object, the
behavior is different. I wonder why.

Thanks, Praki
----- Original Message -----
From: Gal Shachor <sh...@il.ibm.com>
To: <to...@jakarta.apache.org>
Sent: Friday, June 23, 2000 12:35 AM
Subject: Re: forwarding to an error page in tomcat 3.1


>
>
> Praki Prakash wrote:
> >
> > Has anyone successfully used errorPage attribute of the page directive?
The
> > following test jsp file always throws an IllegalStateException. Invoking
> > out.clear displays the error message but still does not forward to
> > error.jsp. Any insights into this are highly appreciated.
> >
> > Thanks, Praki Prakash
> >
> > <%@ page errorPage="error.jsp" buffer="256kb" autoFlush="false"%>
> > <html>
> > <body>
> > Test
> > <% if (true) { throw new Error("This is the error");} %>
> > </body>
> > </html>
> >
>
> What version of Tomcat are you using? It works for me every time (unless
> I flush the output stream).
>
> Gal Shachor
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


Re: forwarding to an error page in tomcat 3.1

Posted by Gal Shachor <sh...@il.ibm.com>.

Praki Prakash wrote:
> 
> Has anyone successfully used errorPage attribute of the page directive? The
> following test jsp file always throws an IllegalStateException. Invoking
> out.clear displays the error message but still does not forward to
> error.jsp. Any insights into this are highly appreciated.
> 
> Thanks, Praki Prakash
> 
> <%@ page errorPage="error.jsp" buffer="256kb" autoFlush="false"%>
> <html>
> <body>
> Test
> <% if (true) { throw new Error("This is the error");} %>
> </body>
> </html>
> 

What version of Tomcat are you using? It works for me every time (unless
I flush the output stream).

	Gal Shachor

Re: forwarding to an error page in tomcat 3.1

Posted by "Eric H." <eh...@usc.edu>.
Error pages work fine for me ;)

I've got pages with 
errorPage="error.jsp"

and then on error.jsp
isErrorPage="true"

(Both in the page tag in the jsp. I do not have errorPage="error.jsp" in
the actual error.jsp. Also I'm using Apache /w Tomcat)

I didn't edit web.xml or server.xml for this.
I did add a 
buffer="20kb"
to the page tag also. Otherwise if an error occurs after the default 8kb
buffer is filled, there's problems. (The buffer gets auto-flushed, so you
can't redirect after that)

On Thu, 22 Jun 2000, Rick Roberts wrote:

> Yea.  What's the deal with that?
> We kicked it around a bit earlier today but I still don't know if it works.
> I get the impression that it's common knowledge that it doesn't???
> Anyone want to help us out here?
> 
> I have the wrox Professional JSP book.  There is discussion there and a simple
> example.  Things don't work as advertised though.
> 
> >From the book:
> <% page errorPage="error1.jsp" %>
> <%= 1/0 %>
> 
> Now that's an error for sure!  But I don't get redirected to my "error1.jsp"
> file.
> There was some talk here earlier about some modification to the web.xml file:
> 
> <web-app>
>   <error-page>
>     <error-code> "your error code here" </error-code>
>     <location> "error1.jsp"</location>
>   </error-page>
> </web-app>
> 
> But, the folks who talked about the web.xml file admitted that they didn't
> have it working either.
> So; can we put this thing to rest?  If it doesn't work and everyone else knows
> it doesn't work the O.K., I can live with it, but I don't want to continue to
> diddle with it if it just doesn't work.
> 
> BTW, I still lurk around the netscape jsp newsgroup and I saw someone there
> complaining about the same thing.  Someone else responded, and here is an
> excerpt from that message.  I don't know what it means, but will include it
> here for completness.
> 
> ---------
> an alternative that i've used is to use the
> respons.sendRedirect() method to redirect to the errorpage.
> 
> the errorpage, named say foo.jsp is a jsp page that accepts
> one parameter , let's say bar.  and then I just display that parameter.
> for example:
> 
> response.sendRedirect("foo.jsp?ERROR=oops");
> 
> and it works fine for me. :)
> -------------
> 
> Thanks,
> 
> Rick
> 
> 
> 
> Praki Prakash wrote:
> 
> > Has anyone successfully used errorPage attribute of the page directive? The
> > following test jsp file always throws an IllegalStateException. Invoking
> > out.clear displays the error message but still does not forward to
> > error.jsp. Any insights into this are highly appreciated.
> >
> > Thanks, Praki Prakash
> >
> > <%@ page errorPage="error.jsp" buffer="256kb" autoFlush="false"%>
> > <html>
> > <body>
> > Test
> > <% if (true) { throw new Error("This is the error");} %>
> > </body>
> > </html>
> >
> > --------------------------------------------------------------------------
> > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commmands, email: tomcat-user-help@jakarta.apache.org
> 
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
> 
> 
> 

-Eric Harashevsky, USC ISD Student Consultant


Re: forwarding to an error page in tomcat 3.1

Posted by Rick Roberts <Ri...@va.prestige.net>.
Yea.  What's the deal with that?
We kicked it around a bit earlier today but I still don't know if it works.
I get the impression that it's common knowledge that it doesn't???
Anyone want to help us out here?

I have the wrox Professional JSP book.  There is discussion there and a simple
example.  Things don't work as advertised though.

>From the book:
<% page errorPage="error1.jsp" %>
<%= 1/0 %>

Now that's an error for sure!  But I don't get redirected to my "error1.jsp"
file.
There was some talk here earlier about some modification to the web.xml file:

<web-app>
  <error-page>
    <error-code> "your error code here" </error-code>
    <location> "error1.jsp"</location>
  </error-page>
</web-app>

But, the folks who talked about the web.xml file admitted that they didn't
have it working either.
So; can we put this thing to rest?  If it doesn't work and everyone else knows
it doesn't work the O.K., I can live with it, but I don't want to continue to
diddle with it if it just doesn't work.

BTW, I still lurk around the netscape jsp newsgroup and I saw someone there
complaining about the same thing.  Someone else responded, and here is an
excerpt from that message.  I don't know what it means, but will include it
here for completness.

---------
an alternative that i've used is to use the
respons.sendRedirect() method to redirect to the errorpage.

the errorpage, named say foo.jsp is a jsp page that accepts
one parameter , let's say bar.  and then I just display that parameter.
for example:

response.sendRedirect("foo.jsp?ERROR=oops");

and it works fine for me. :)
-------------

Thanks,

Rick



Praki Prakash wrote:

> Has anyone successfully used errorPage attribute of the page directive? The
> following test jsp file always throws an IllegalStateException. Invoking
> out.clear displays the error message but still does not forward to
> error.jsp. Any insights into this are highly appreciated.
>
> Thanks, Praki Prakash
>
> <%@ page errorPage="error.jsp" buffer="256kb" autoFlush="false"%>
> <html>
> <body>
> Test
> <% if (true) { throw new Error("This is the error");} %>
> </body>
> </html>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org