Java Server Pages: A Code-Intensive Premium Reference- P8:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | throw new Exception A Pure JSP Exception You will notice in this listing that the first line of code sets the errorPage equal to which is the name of our error page. The rest of our example is just used to throw an exception that will not be caught. That is all there is to it. Just copy both of these JSPs to the SERVER_ROOT purejsp directory and open the test-error. j sp page in your browser. You will see a page similar to Figure . Figure Output of the example. To see how this error is handled in the actual compiled code let s take a look at the _jspService method generated from the example. The following code snippet contains the generated jspService method public void _jspService HttpServletRequest request HttpServletResponse response throws lOException ServletException JspFactory _jspxFactory null PageContext pageContext null HttpSession session null ServletContext application null ServletConfig config null JspWriter out null Object page this String _value null try if _jspx_inited false _jspx_init _jspx_inited true - 71 - _jspxFactory text html pageContext this request response true 8192 true application config session out begin r n r n end begin file D from 2 2 to 10 0 if true Just throw an exception throw new Exception A Pure JSP Exception end begin r n end catch Exception ex if 0 ex finally pageContext The first section of code you need to look at is the call to get the PageContext object from the JspFactory using the getPageContext method. This method obtains an instance of an implementation dependent abstract class for the calling servlet - 72 - and .