JSP Exception. Printstacktrace() method: outputs abnormal stack trace

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
分享
二维码
< <上一篇
下一篇>>