3 Replies Latest reply on Oct 4, 2010 10:50 AM by nbelaevski

    Message in PaginationDataModel

    krasig

      We have custom implementation of PaginationDataModel but cand find a way to send message when exception is thrown

       

      Any suggestions is welcome.

        • 1. Re: Message in PaginationDataModel
          nbelaevski

          Hi Krasimir,

           

          Can you please provide more details on the problem?

          • 2. Re: Message in PaginationDataModel
            krasig

            PaginatingDataModel extends SerializableDataModel

             

            Usually in walk method we execute SELECT statement and if in this statement have some problem (syntax, DB Lock ...) we catch this and send message to user with addMessage, but message never shown on page.

             

            Just put in walk method

             

            FacesContext.getCurrentInstance().addMessage(null,
                            new FacesMessage(severity, message, details));

             

             

             

            Regards.

            • 3. Re: Message in PaginationDataModel
              nbelaevski

              Krasimir,

               

              This won't work well as components are rendered sequentially, so h:messages/rich:messages will render what has been queued by that moment and then your code adds messages.

               

              Either place messages component after the table or use another style of errors reporting (e.g. throw exception).