JavaSercer Pages Also note that the error page (Hosting j2ee)
JavaSercer Pages Also note that the error page URL in Example 7.9 includes the debug request parameter, and that a scriptlet is used to set a request attribute: <%@ page errorPage="errorpage.jsp?debug=log" %> <% request.setAttribute("sourcePage", request.getRequestURI( )); %> The debug parameter lets you use the DebugBean to log information about what went wrong in the error page. The sourcePage attribute, set to the URL for the current page, is also used in the error page, as you will see shortly. The rest of the page in Example 7.9 implements a simple calculator, shown in Figure 7.4. It’s intended only to illustrate how the error page handling works, so I will not describe it in detail. When you’re done reading this book, it might be a good exercise to figure it out yourself by looking at the source code. Figure 7.4. Calculator page If a user tries to divide a number by zero, the CalcBean used in this page to implement the calculator throws an exception. This triggers the error page shown in Example 7.10 to be invoked. Example 7.10. Error Page (errorpage.jsp) <%@ page language="java" contentType="text/html" %> <%@ page isErrorPage="true" %>
We’re sorry but the request could not be processed. The processing error message is:<%= exception.getMessage( ) %>
The message has been logged together with more detailed information about the error so we can analyze it further. Please try again, and let us know if the problem persists. <% application.log((String) request.getAttribute("sourcePage"), exception); %>
Note: If you are looking for best hosting provider to host and run your tomcat application check Astra tomcat hosting services