How to handle error object in JSP using JSTL tags?

You can make use of JSTL tags to write an error page ShowError.jsp with better structure and more information ?




   
      Show Error Page
   
   
      

Opps...

     
                                                                                                                                                                                 
Error:${pageContext.exception}
URI:${pageContext.errorData.requestURI}
Status code:${pageContext.errorData.statusCode}
Stack trace:                            

${trace}

           
         
   

Access the main.jsp, the following will be generated ?

Opps...

Error:
java.lang.RuntimeException: Error condition!!!
URI:
/main.jsp
Status code:
500
Stack trace:
org.apache.jsp.main_jsp._jspService(main_jsp.java:65)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Updated on: 2019-07-30T22:30:25+05:30

643 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements