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

    Exceptions to rich:messages

    Peter Schütt Newbie

      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 Master

          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
            Peter Schütt Newbie

            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 Master

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