3 Replies Latest reply on Apr 21, 2011 9:52 AM by iabughosh

    Exceptions to rich:messages

    pschuett

      Hallo,

      how can I send any unexpected exception (program failure) to a global rich:messages control?

       

      Thanks for any help.

       

      Ciao

        Peter Schütt

        • 1. Exceptions to rich:messages
          iabughosh

          you can add messages using FacesContext :

           

          try {

          //your code

                              } catch(MyException e) {

                                        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,

                                                                                                                                                                                                                  e.getMessage(),

                                                                                                                                                                                                                  e.getMessage()));

                              }

          • 2. Exceptions to rich:messages
            pschuett

            Hallo,

            I do not want to implement an exception handler at every place.

            I want to put _every_ uncatched exception to the rich:messages control.

             

            Ciao

            Peter Schütt

            • 3. Exceptions to rich:messages
              iabughosh

              if you are using JSF 2 then you can use SystemEvents, event type : ExceptionQueuedEvent