applicationErrorPage.jsp
<%--
/**
 * This page is dedicated to print all web application Exceptions.
 *
 @author Sofoklis Stouraitis
 */
--%>

<%--   Set content type --%>
<%page contentType="text/html; charset=Windows-1253" %>

<%--   Import necessary libs --%>
<%page import="java.io.*" %>

<%--   Define this jsp page as an error page.
  This means that this page is dedicated to print all errors (Exceptionswhich come from the rest jsp pages
--%>
<%page isErrorPage="true" %>

<html>
  <head>
    <title>1ο Παράδειγμα JSP - applicationErrorPage.jsp Source</title>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1253">
  </head>
  <body>
    
<%--   We need this line in order to pass parameters in greek, we can use UTF-charset as well.
  Try to comment out ("//"this line to see the difference.
--%>    
<% request.setCharacterEncoding("ISO-8859-7"); %>
        
<%--   Include page "header.jsp" passing the parameter "exampleNumber" --%>        
<jsp:include page="header.jsp"
  <jsp:param name="exampleNumber" value="1ο Παράδειγμα" /> 
</jsp:include>

<%--   Put try and catch block in case the page is called directly (which means that our Application did not throw an Exception
  If not Http Status 500 Error will occur.
  example try the above:
  1comment out "try {"  ("//try {")
  2put "<%- -" just after the line: "</table>" with no space between -
  3put "- -%>" just before the line: "</div>"  with no space between -
--%>
<%
  try {  
    Class exClass = exception.getClass();  
    String exMessage = exception.getMessage();
%>
      
    <div style="height:500px;text-align:center;">
      <h1><font color="#000066"><strong>"applicationErrorPage.jsp" is running...</strong></font></h1>
      <br/>
            
            <h1>Hey watch out...JSP encounter an Error!!!</h1>         
           
           <h2>Exception Information</h2>  
           
           <table align="center">      
        <tr>
          <td>Exception Class:</td>
          <td><%= exClass %></td>
        </tr>
      
        <tr>
          <td>Exception Message:</td>
          <td><%= exMessage %></td>
        </tr>      
      </table>
    
<%   catch(Exception e) {
    /*
     * When called directly, redirects to page "jspExercise1.jsp"
     */
        response.sendRedirect("jspExercise1.jsp");
     // End of catch
%>

    </div>  
    
<%-- Include the page "footer.html" --%>    
<jsp:include page="footer.html" />
    
  </body>
</html>