### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev

## 4.12. Errors Reports

The Photo Album application has a global mechanism for errors checking. You become informed about the error each time it occurs. It is possible because the main page of the application `web/src/main/webapp/index.xhtml` includes the `web/src/main/webapp/includes/misc/errorPanel.xhtml`:

    ...

    <a4j:outputPanel id="errors" ajaxRendered="true">

            <h:panelGroup rendered="#{errorHandlerBean.errorExist}">

                <rich:modalPanel id="errorPanel" showWhenRendered="true" minWidth="300" minHeight="200" autosized="true">

                          ...

                </rich:modalPanel>

          </h:panelGroup>

    </a4j:outputPanel>

    ...

Here is the listing of the `errorHandlerBean` class:

    package org.richfaces.photoalbum.ui;

    import java.util.ArrayList;

    import java.util.List;

    import org.jboss.seam.ScopeType;

    import org.jboss.seam.annotations.AutoCreate;

    import org.jboss.seam.annotations.Name;

    import org.jboss.seam.annotations.Observer;

    import org.jboss.seam.annotations.Scope;

    import org.richfaces.photoalbum.service.Constants;

    @Name("errorHandlerBean")

    @Scope(ScopeType.EVENT)

    @AutoCreate

    public class ErrorHandlerBean {

        private List<String> errors = new ArrayList<String>();

        public List<String> getErrors() {

            return errors;

        }

        public boolean isErrorExist(){

            return errors.size() > 0 ;

        }

        @Observer(Constants.ADD_ERROR_EVENT)

        public void addToErrors(String e){

            errors.add(e);

        }

    }

The error panel contains the <a4j:outputPanel> component that is rendered on every Ajax request (`ajaxRendered="true"`). If an error is occurred the `isErrorExist()` method of `errorHandlerBean` class returns "true", so the <h:panelGroup> component is rendered. In order to show nested <rich:modalPanel> component with the collected errors the "showWhenRendered" attribute should be set to "true".

The `addToErrors()` method is annotated with `@Observer` annotation, thus it observes all events with `ADD_ERROR_EVENT` constant and adds errors to the `errors` List.

- Prev4.11. The <a4j:status> component
- Top of page
- Front page