多个错误代码配置web.xml [英] multiple error-code configuration web.xml

查看:130
本文介绍了多个错误代码配置web.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把所有的错误引导到我的Errorsevlet,而不是明确地指定所有的代码。有没有办法做这样的事情?

I'd like to direct all errors to my Errorsevlet without specifying all the codes explicitly. Is there any way to do like that?

<error-page>
   <error-code>400</error-code>
   <location>/servlet/com.abc.servlet.ErrorServlet</location>
</error-page>

**到达ErrorServlet后,如何获取servlet中错误的堆栈跟踪。所以我可以发送一个错误的电子邮件的细节。 **

**And after reaching the ErrorServlet how can i get the stack trace of the error in the servlet. So that i can email the details when one error occurs. **

推荐答案

<error-page>
    <exception-type>java.lang.Throwable</exception-type> 
    <location>/servlet/com.ibm.eisa.servlet.ErrorServlet</location> 
</error-page>

尝试这一个,你的所有错误都会被捕获(500的)不是404等

Try this one, all of your errors will be caught(500's) not 404 etc

这篇关于多个错误代码配置web.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆