public int doEndTag() throws JspException {
   try {
     return super.doEndTag();
   } catch (Exception e) {
     Throwable root = e;
     while (root.getCause() != null) {
       root = root.getCause();
     }
     throw new JspException(root);
   }
 }
 /**
  * (non-Javadoc)
  *
  * @see javax.servlet.http.HttpServlet#service(javax.servlet.ServletRequest,
  *     javax.servlet.ServletResponse)
  */
 public void service(ServletRequest _request, ServletResponse _response)
     throws ServletException, IOException {
   try {
     _delegate.service(_request, _response);
   } catch (Throwable ex) {
     // Make Sure the Stack Trace is Printed to the Log
     ex.printStackTrace();
     // Set the Data to be Displayed
     AErrorHandler.setPageErrorData(ex, (HttpServletRequest) _request);
     // Re-direct to Error Page
     redirectToErrorPage((HttpServletRequest) _request, (HttpServletResponse) _response);
   }
 }