Broken? <error-page> in web.xm under tomcat 4.x  
Author Message
bjs3





PostPosted: 2003-8-26 17:51:00 Top

java-programmer, Broken? <error-page> in web.xm under tomcat 4.x Hello,

I am running Tomcat 4.x and have tried to set global error handling
using the following kind of entries in the web.xml file. But there is
no redirection and I always end up with the tomcat generated error
page in the browser.

Does anyone have a solution to this problem?

<error-page>
<error-code>500</error-code>
<location>/weberror.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/weberror.jsp</location>
</error-page>

Thanks

Bruce Sams
 
giffy_jif





PostPosted: 2003-9-16 18:20:00 Top

java-programmer >> Broken? <error-page> in web.xm under tomcat 4.x From the servlet specification:

"The error page mechanism described does not intervene when errors
occur in
servlets invoked using the RequestDispatcher."

Do you use Struts? With Struts, the request is *dispatched* to JSP
page, therefore you will not see the error page set up in web.xml. Try
accessing your JSP page without going through the action servlet, so
instead of typing http://localhost:8080/myapp/test.do, type
http://localhost:8080/myapp/test.jsp. You can use <global-exceptions>
in struts-config.xml to achieve what you tried to do with <error-page>
in web.xml.

Jonni Gani

email***@***.com (Bruce Sams) wrote in message news:<email***@***.com>...
> Hello,
>
> I am running Tomcat 4.x and have tried to set global error handling
> using the following kind of entries in the web.xml file. But there is
> no redirection and I always end up with the tomcat generated error
> page in the browser.
>
> Does anyone have a solution to this problem?
>
> <error-page>
> <error-code>500</error-code>
> <location>/weberror.jsp</location>
> </error-page>
> <error-page>
> <exception-type>java.lang.Exception</exception-type>
> <location>/weberror.jsp</location>
> </error-page>
>
> Thanks
>
> Bruce Sams