You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chetan Pandey <cp...@bluesingapore.com> on 2006/10/30 12:44:17 UTC

Error Pages in Struts App

Hi All:

 

I am trying to include an Error Page in my Struts-based Web App.

 

The following is what I have in my web.xml

 

<error-page> 

<error-code>404</error-code> 

<location>/errorPage.jsp</location> 

</error-page> 

 

<error-page>

<exception-type>java.lang.Exception</exception-type>

<location>/errorPage.jsp</location>

</error-page>

 

In one of my JSP Page - for testing purposes - I have included the
following:

 

Integer ii = Integer.valueOf("XXX");

Which should give a NumberFormatException.

 

However, the following is what I get when I try to access this JSP Page in
my Eclipse-Console:

 

SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception,
location=/errorPage.jsp]

java.lang.IllegalStateException

      at org.apache.coyote.Response.reset(Response.java:296)

      at org.apache.catalina.connector.Response.reset(Response.java:652)

      at org.apache.catalina.connector.Response.reset(Response.java:918)

            et c.

 

My File errorPage.jsp opens up fine if I try to open it independently.

 

Code of errorPage.jsp is as follows:

<html><body>

Their was an Error.

Caused by ${pageContext.exception} <br>

</body></html>


Re: Error Pages in Struts App

Posted by Juanjo Cuadrado <jj...@gmail.com>.
Hi,

    I think that you have to put the follow in the first line of your error
page:

<%@ page isErrorPage="true" %>


2006/10/30, Chetan Pandey <cp...@bluesingapore.com>:
>
> Hi All:
>
>
>
> I am trying to include an Error Page in my Struts-based Web App.
>
>
>
> The following is what I have in my web.xml
>
>
>
> <error-page>
>
> <error-code>404</error-code>
>
> <location>/errorPage.jsp</location>
>
> </error-page>
>
>
>
> <error-page>
>
> <exception-type>java.lang.Exception</exception-type>
>
> <location>/errorPage.jsp</location>
>
> </error-page>
>
>
>
> In one of my JSP Page - for testing purposes - I have included the
> following:
>
>
>
> Integer ii = Integer.valueOf("XXX");
>
> Which should give a NumberFormatException.
>
>
>
> However, the following is what I get when I try to access this JSP Page in
> my Eclipse-Console:
>
>
>
> SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception,
> location=/errorPage.jsp]
>
> java.lang.IllegalStateException
>
>       at org.apache.coyote.Response.reset(Response.java:296)
>
>       at org.apache.catalina.connector.Response.reset(Response.java:652)
>
>       at org.apache.catalina.connector.Response.reset(Response.java:918)
>
>             et c.
>
>
>
> My File errorPage.jsp opens up fine if I try to open it independently.
>
>
>
> Code of errorPage.jsp is as follows:
>
> <html><body>
>
> Their was an Error.
>
> Caused by ${pageContext.exception} <br>
>
> </body></html>
>
>
>