JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»


Removes the Orderitem with the specified SKU from the order.


О


e о


О

Generic error view


The generic error view is a single card view used to catch any error thrown by any of our JSP pages that does not explicitly name another error page. This page is called jspException.jsp inside our application, as displayed in listing 14.16.


Listing 14.16 jspException.jsp


<%@ page contentType=»text/vnd.wap.wml;charset=UTF-8 isErrorPage=»true» %>


<%@ taglib


uri=»http://www.manning.com/jsptagsbook/beans-taglib» prefix=»bean» %>


<?xml version=»1.0″?>


<!DOCTYPE wml PUBLIC «-//WAPFORUM//DTD WML 1.1//EN»


«http://www.wapforum.org/DTD/wml_1.1.xml«>


<wml>


<card id=»welcome»


title=»Cosmetix»>


<j sp:include page=»userMenu.jsp» flush=»true»/>


<p align=»left»>


<bean:show object=»<%=exception%> property=»message»/>


</p>


</card>


</wml>


о Defines this page as an error page. e Includes the user menu view. Displays the exceptions message.


This view is defined as an error page in the web application’s configuration file (web.xml) and does not therefore need to be defined in any page that could throw a generic runtime exception. This configuration looks like listing 14.17, which is cut out from the web.xml file of our web-application.


Listing 14.17 The configuration of the JspException handler in the web.xml file


<error-page>


<exception-type>javax.servlet.jsp.JspException</exception-type> <location>jspException.j sp</location>


</error-page>


The configuration tells the container that whenever an uncaught JspException is thrown, jspException.jsp should be invoked. Any error page defined within a page overrides the applicationwide setting.

Instantiation error view


The instantiation error view is called when we try to access the Customer EJB from the session scope but no such object exists. The page is called instantiationExcep-tion.jsp in our application and looks like listing 14.18.

Скачать в pdf «JSP Tag Libraries»