- /**
- * 将当前上下文发生的异常转为字符串
- * @return
- * @throws IOException
- */
- private static Throwable getException(HttpServletRequest req) {
- if(req == null) return null;
- Throwable t = (Throwable)req.getAttribute(PageContext.EXCEPTION);
- if(t==null){
- //Tomcat的错误处理方式
- t = (Throwable)req.getAttribute("javax.servlet.error.exception");
- }
- return t;
- }
- //该片段来自于http://www.codesnippet.cn/detail/270320132594.html
来源: http://www.codesnippet.cn/detail/270320132594.html