error.jsp
来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 165 行
JSP
165 行
<%/** * $RCSfile: error.jsp,v $ * $Revision: 1.4 $ * $Date: 2002/04/30 14:41:54 $ */%><%@ page import="java.io.*, java.util.*, java.net.*, com.jivesoftware.forum.*, com.jivesoftware.util.*, com.jivesoftware.forum.util.SkinUtils" isErrorPage="true"%><% // Get the Jive locale: Locale locale = JiveGlobals.getLocale(); // Get the URI/query string of the page that threw an error: (this value // is set in global.jsp and exists for every page) String uri = (String)request.getAttribute("jive.uri"); // If DEBUG is set to true, stack traces will be written to your // System.err log boolean DEBUG = "true".equals(JiveGlobals.getJiveProperty("skin.default.debug")); if (DEBUG) { System.err.println(SkinUtils.getLocalizedString("skin.default.error.jive",locale)); exception.printStackTrace(); } String stackTrace = null; if (exception != null) { StringWriter sout = new StringWriter(); PrintWriter pout = new PrintWriter(sout); exception.printStackTrace(pout); stackTrace = sout.toString(); stackTrace = StringUtils.replace(stackTrace,"\n","<br>"); stackTrace = StringUtils.replace(stackTrace,"\r",""); stackTrace = StringUtils.replace(stackTrace,"\"","'"); } // Do a check to see what type of exception the exception variable is. boolean isLicenseEx = false; boolean isUnauthEx = false; boolean isForumNotFoundEx = false; boolean isThreadNotFoundEx = false; boolean isMessageNotFoundEx = false; boolean isUserNotFoundEx = false; boolean isAttachEx = false; boolean isUnsupportedOpEx = false; if (exception instanceof LicenseException) { isLicenseEx = true; } else if (exception instanceof UnauthorizedException) { isUnauthEx = true; } else if (exception instanceof ForumNotFoundException) { isForumNotFoundEx = true; } else if (exception instanceof ForumThreadNotFoundException) { isThreadNotFoundEx = true; } else if (exception instanceof ForumMessageNotFoundException) { isMessageNotFoundEx = true; } else if (exception instanceof UserNotFoundException) { isUserNotFoundEx = true; } else if (exception instanceof AttachmentException) { isAttachEx = true; } else if (exception instanceof UnsupportedOperationException) { isUnsupportedOpEx = true; } // If it's an UnauthorizedException, redirect to the login page if (isUnauthEx) { response.sendRedirect("auth.jsp?unauth=true"); return; }%><html><head> <title><%= SkinUtils.getLocalizedString("skin.default.error.title",locale) %></title> <script language="JavaScript" type="text/javascript"> <!-- function openWin() { var options = "menubar=yes,location=no,scrollbars=yes,personalbar=no,width=600,height=400,resizable"; var newWin = window.open("","stackTraceWindow",options); newWin.document.writeln("<html><head><title><%= SkinUtils.getLocalizedString("skin.default.error.title",locale) %>" + "</title></head><body><b><%= SkinUtils.getLocalizedString("skin.default.error.summary",locale) %></b>" + "<hr size=\"0\"><%= SkinUtils.getLocalizedString("skin.default.error.version",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %> " + "<%= JiveGlobals.getJiveVersion() %><hr size=\"0\">" + "<%= SkinUtils.getLocalizedString("skin.default.error.stack_trace",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %> <br><pre>"); <% if (stackTrace != null) { %> newWin.document.writeln("<%= stackTrace %>"); <% } else { %> newWin.document.writeln("<i><%= SkinUtils.getLocalizedString("skin.default.error.no_stack_trace",locale) %></i>"); <% } %> newWin.document.writeln("</pre></body></html>"); } //--> </script></head><body><font face="arial,helvetica,sans-serif"><b><%= SkinUtils.getLocalizedString("skin.default.error.title",locale) %></b><hr size="0"><font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"><% if (isLicenseEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.license",locale) %><% } else if (isForumNotFoundEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.forum",locale) %><% } else if (isThreadNotFoundEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.thread",locale) %><% } else if (isMessageNotFoundEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.message",locale) %><% } else if (isUserNotFoundEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.user",locale) %><% } else if (isAttachEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.attachment",locale) %><% } else if (isUnsupportedOpEx) { %> <%= SkinUtils.getLocalizedString("skin.default.error.unsupported_op",locale) %><% } else { // general error %> <%= SkinUtils.getLocalizedString("skin.default.error.general",locale) %><% } %></font><p><font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"><a href="#" onclick="openWin();return false;"><%= SkinUtils.getLocalizedString("skin.default.error.summary_short",locale) %></a></font><% if (DEBUG) { %><p><pre><%= stackTrace %></pre><% } %></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?