Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

280 C HAPTER 7 Getting started with Spring Portlet MVC <set> <ref bean="showBooksController"/> </set> </property> <property name="defaultErrorView" value="defaultViewName"/> </bean> In the preceding definition of an exception resolver, if an exception that doesn't con- tain StateException in its name is thrown by the showBooksController handler, the defaultViewName view is rendered. THE HANDLER-EXCEPTION-RESOLVER CHAIN The order property defines the priority of the handler exception resolver. As with handler mappings, the order property is used for chaining handler exception resolv- ers. The exception resolver with the lowest order value is applied first for resolving the thrown exception. If the exception is resolved by an exception resolver in the chain, the execution of the chain is aborted and the ModelAndView object is returned to the DispatcherPortlet . ACCESSING THE EXCEPTION AS A MODEL ATTRIBUTE The exceptionAttribute property specifies the name of the model attribute with which the exception is available as a request attribute. You can use this exception attribute in your JSP pages to show the message contained in the exception.