Home Jsp Simple-jsp-example printStackTrace in JSP



printStackTrace in JSP
Posted on: March 12, 2008 at 12:00 AM
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.

Related Tags for printStackTrace in JSP:
cexceptionerrorclassormprocessformiostackmethodformatprintgettracetracstacktraceusingintthisrowifforinformationprocethrowcanfromceinrminfoasstamntouttrcaaceclesthrowablemehrproacksessatowaracracekisinfexceptssrocrithstabablatiinforminformatprocesprprintstacktraceonomo


More Tutorials from this section

Ask Questions?    Discuss: printStackTrace in JSP  

Post your Comment


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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.