JSP Exception. Printstacktrace() method: outputs abnormal stack trace
•
Java
Grammar 1
printStackTrace()
Example
<%@page language="java" errorPage="error.jsp" pageEncoding="GBK"%>
<%
Integer.parseInt("异常测试");
%>
<%@page language="java" pageEncoding="GBK" isErrorPage="true"%>
<%
exception.printStackTrace();
%>
Grammar 2
printStackTrace(PrintStream s)
Example
<%@page language="java" pageEncoding="GBK" errorPage="error.jsp"%>
<%
Integer.parseInt("测试");
%>
<%
PrintStream s = new PrintStream("c:\\servlet.log");
exception.printStackTrace(s);
s.close();
%>
Grammar 3
printStackTrace(PrintWriter s)
Example
<%@page language="java" pageEncoding="GBK" errorPage="error.jsp"%>
<%
Integer.parseInt("测试");
%>
<%
PrintWriter s = new PrintWriter("c:\\servlet.log");
exception.printStackTrace(s);
s.close();
%>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
