All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.asset.common.jsp.error.jsp Maven / Gradle / Ivy

Go to download

AJAXJS Web aims to full-stack, not only the server-side framework, but also integrates the front-end library. It'€™s written in HTML5 + Java, a successor to the JVM platform, efficient, secure, stable, cross-platform and many other advantages, but it abandoned the traditional enterprise architecture brought about by the large and bloated, emphasizing the lightweight, and fast, very suitable for the Internet fast application.

There is a newer version: 1.3.0
Show newest version
<%@page pageEncoding="UTF-8" isErrorPage="true" import="java.io.*"%>
<%!
	/**
	 * 收集错误信息 输出到网页
	 * 
	 * @param request
	 *            请求对象
	 */
	public static OutputStream getError(HttpServletRequest request, Throwable ex) {
		OutputStream os = new ByteArrayOutputStream();// 创建一个空的字节流,保存错误信息
		PrintStream ps = new PrintStream(os);

		// 不要用 java 7 的 autoClose,因为要在 tomcat 里面手动打开
		try {
			// 收集错误信息
			ps.println("错误代码: " + request.getAttribute("javax.servlet.error.status_code").toString().replaceAll("<|>", ""));
			ps.println("异常 Servlet: " + request.getAttribute("javax.servlet.error.servlet_name").toString().replaceAll("<|>", ""));
			ps.println("出错页面地址: " + request.getAttribute("javax.servlet.error.request_uri").toString().replaceAll("<|>", ""));
			ps.println("访问的路径: " + request.getAttribute("javax.servlet.forward.request_uri").toString().replaceAll("<|>", ""));
			ps.println();

			for (String key : request.getParameterMap().keySet()) {
				ps.println("请求中的 Parameter 包括:");
				ps.println(key + "=" + request.getParameter(key));
				ps.println();
			}

			if (request.getCookies() != null) {
				for (Cookie cookie : request.getCookies()) {
					ps.println("请求中的 Cookie 包括:");
					ps.println(cookie.getName() + "=" + cookie.getValue());
					ps.println();
				}
			}
			// javax.servlet.jspException 等于 JSP 里面的 exception 对象
			if (ex != null) {
				ps.println("堆栈信息");
				ex.printStackTrace(ps);
				ps.println();
			}

			return os;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			try {
				os.close();
				ps.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}%>



	
	
	错误页面 code:${requestScope['javax.servlet.error.status_code']}
	


	
服务端异常-HTTPStatusCode:${requestScope['javax.servlet.error.status_code']}

   非常抱歉,服务器运行出错!异常信息:

回首页 | 上一页




© 2015 - 2024 Weber Informatics LLC | Privacy Policy