Book Image

PrimeFaces Cookbook

Book Image

PrimeFaces Cookbook

Overview of this book

Table of Contents (20 chapters)
PrimeFaces Cookbook Second Edition
Credits
Foreword
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Possibilities for exception handling in PrimeFaces


PrimeFaces provides powerful exception handling for AJAX and non-AJAX requests out of the box. The mapping between error pages and exception types is configured via the error-page ability in web.xml. Exceptions for AJAX requests can also be configured via the special p:ajaxExceptionHandler tag in order for them to be shown on the same page where they occurred. An implicit object, pfExceptionHandler, provides useful information about exception details.

In this recipe, we will give helpful tips about configuration details and demonstrate PrimeFaces' exception handling for AJAX and non-AJAX requests.

Getting ready

In order to be able use the exception handling, a special EL resolver and a factory class for 'ExceptionHandler of PrimeFaces should be registered in faces-config.xml:

<application>
  <el-resolver>
    org.primefaces.application.
      exceptionhandler.PrimeExceptionHandlerELResolver
  </el-resolver>
</application...