■■有捕获jsp系统错误代码的例子吗?■■ 把你的错误信息存在session里,然后在catch{}里最后做一个跳转response.sendRedirect("/error.jsp");error.jsp取session显示错误信息这是简单的方法之一, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以在页面中设置error.jsp错误页,并在error.jsp中指定iserrorpage="true",一般error中的代码很简单,如下:<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" isErrorPage="true" %><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>错误信息页</title></head><body bgcolor="buttonface"><table width="60%" align=center border=0 cellspacing=0 cellpadding=0><tr height=35><td colspan=2 align=center style="font:14px;font-weight:600;">系统出错报告</td></tr> <tr height=35><td colspan=2 align=left style="font:14px">应用程序异常出错!</td></tr> <tr height=35><td colspan=2 align=left style="font:14px">错误信息:</td> </tr> <tr><td colspan=2 style="color:red"> <%=exception.getMessage()%></td></tr> <tr height=60><td colspan=2></td></tr> <tr height=60> <td align=center><input type=button hidefocus style="font:14px" name=btnreturn value="后 退"></td> <td align=center><input type=button hidefocus style="font:14px" name=btnreLogin value="重新登录"></td> </tr></body></html> 那是因为你在有抛出错误的地方没有调用try块的原因。try{ } catch(Exception e){ out.println(e.getMessage());} 我们在项目中,错误面一般中这么写<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" isErrorPage="true" %><html><head><title>错误面</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><% out.println(exception.toString()); exception.printStackTrace();%></body></html>其它页面只需将errorPage指定到些错误页即可 ■■上面各位,这样仍然不能捕获tomcat服务器的HTTP 404和500的系统错误啊,仍然显示的是系统错误页面,没有显示error.jsp,请再继续。。■■ 用过DJNativeSwing-SWT进来看看, 帮帮忙.. 求救! 帮我找出滚动条! 后台数据量很大,造成前台页面生成的时候很卡.请求一下有什么好的解决方法 权限管理啊 一个ext问题 跪求 一个异常! [在线等]textarea 为什么在为空的时候,既不是""也不是NULL呢??? 困扰了我一天的正则表达式写法问题,急!!!大家帮帮忙,100分.. JSP框架传值问题 100分在线等待 没有密码用户名的数据库怎么设置连接池?? 请问返回记录集很多的时候提示违反协议? 又是可恶的乱码问题
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" isErrorPage="true" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>错误信息页</title>
</head><body bgcolor="buttonface">
<table width="60%" align=center border=0 cellspacing=0 cellpadding=0>
<tr height=35><td colspan=2 align=center style="font:14px;font-weight:600;">系统出错报告</td></tr>
<tr height=35><td colspan=2 align=left style="font:14px">应用程序异常出错!</td></tr>
<tr height=35><td colspan=2 align=left style="font:14px">错误信息:</td> </tr>
<tr><td colspan=2 style="color:red"> <%=exception.getMessage()%></td></tr>
<tr height=60><td colspan=2></td></tr>
<tr height=60>
<td align=center><input type=button hidefocus style="font:14px" name=btnreturn value="后 退"></td>
<td align=center><input type=button hidefocus style="font:14px" name=btnreLogin value="重新登录"></td>
</tr>
</body>
</html>
try{
}
catch(Exception e){
out.println(e.getMessage());
}
<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" isErrorPage="true" %>
<html>
<head>
<title>错误面</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body>
<%
out.println(exception.toString());
exception.printStackTrace();
%>
</body>
</html>其它页面只需将errorPage指定到些错误页即可