printStackTrace in JSP

printStackTrace is a method of the Throwable class. By using this method we can get more information about the error process if we print a stack trace from the exception.

printStackTrace in JSP

        

printStackTrace is a method of the Throwable class. By using this method we can get more information about the error process if we print a stack trace from the exception. 

The code of the program is given below:

<HTML>
    <HEAD>
        <TITLE>Trace a Stack to the Server Console</TITLE>
    </HEAD>
    <BODY>
	<FONT SIZE="5" COLOR="#660033" align="center">
        Trace a Stack to the Server Console</FONT>
        <%
		try{
               int a[] =new int[6];
		for(int i = 0; i<7; i++){
		
		 a[i]=i;
		}
            }
            catch (Exception e){
                e.printStackTrace();
            }
        %>
    </BODY>
</HTML>

 

Output of the Program:

java.lang.ArrayIndexOutOfBoundsException: 6 at org.apache.jsp
.pages.PrintingStack_jsp._jspService(PrintingStack_jsp.
java:56)at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:97)at javax.servlet.http.HttpServlet.service
(HttpServlet.java:802)at org.apache.jasper.servlet.
JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:264)at javax.servlet.http.HttpServlet
.service(HttpServlet.java:802)at org.apache.catalina.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain
.java:252)at org.apache.catalina.core.ApplicationFilterChain
.doFilter(ApplicationFilterChain.java:173)     

Download this example.

Advertisements

Share on Google+Share on Google+

printStackTrace in JSP

Posted on: March 12, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: printStackTrace in JSP  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads