JavaSercer Pages Example 7.9 shows a JSP page (Oscommerce web hosting)

JavaSercer Pages Example 7.9 shows a JSP page with a page directive that defines an error page. Example 7.9. Page with an Error Page Definition (calc.jsp) <%@ page language="java" contentType="text/html" %> <%@ page errorPage="errorpage.jsp?debug=log" %> <% request.setAttribute("sourcePage", request.getRequestURI( )); %> <%-- Calculate the new numbers and state info --%> <% String currentNumber = calc.getCurrentNumber( ); %>

<%= currentNumber.equals("") ? " " : currentNumber %>
 
   

The errorPage attribute in the page directive specifies the URL path for the page displayed if an exception is thrown by any component or scripting code. In JSP 1.1, you cannot specify a regular HTML page as the error page; it must be another JSP page. When the path is specified as in Example 7.9, the error page must be located in the same directory as the page that references it. However, if it starts with a slash (/), it’s interpreted as relative to the application’s context path. The context path is simply the root for all HTML, image, and JSP pages in an application, such as C:Jakartajakarta-tomcatwebappsora for the application containing all book examples (if you installed it in the directory specified in Chapter 4 ). This means you can define a common error page for all the JSP pages in an application, even if you place them in multiple subdirectories, by using a path like /errorpage.jsp. page 84
Note: If you are looking for reliable and quality webspace company to host and run your servlet application check professional servlet hosting services

Comments are closed.