Action调用Service,Service抛出异常,Action可以捕获到,但我现在不想捕获,想直接把异常输出到页面中去。
我定义了errorPage.jsp,并且isErrorPage="true"。
errorPage.jsp代码如下
Exception e = null;if(exception != null) {
e = (Exception)exception;} else if(request.getAttribute("exception") != null) {
e = (Exception)request.getAttribute("exception");
} else if(request.getAttribute("javax.servlet.error.exception") != null) {
e = (Exception)request.getAttribute("javax.servlet.error.exception");
} else if(request.getAttribute("javax.servlet.jsp.jspException") != null) {
e = (Exception)request.getAttribute("javax.servlet.jsp.jspException");
}可到最后e=null,异常信息怎么也出不来,请问大家帮忙看看,谢谢了~~
我定义了errorPage.jsp,并且isErrorPage="true"。
errorPage.jsp代码如下
Exception e = null;if(exception != null) {
e = (Exception)exception;} else if(request.getAttribute("exception") != null) {
e = (Exception)request.getAttribute("exception");
} else if(request.getAttribute("javax.servlet.error.exception") != null) {
e = (Exception)request.getAttribute("javax.servlet.error.exception");
} else if(request.getAttribute("javax.servlet.jsp.jspException") != null) {
e = (Exception)request.getAttribute("javax.servlet.jsp.jspException");
}可到最后e=null,异常信息怎么也出不来,请问大家帮忙看看,谢谢了~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货