5 Replies Latest reply on Oct 25, 2011 12:14 AM by Luca Cavagnoli

    Seam 3.1.0.Beta3 Bug - Messages NOT displayed

    Luca Cavagnoli Newbie

      I opened the security-idmconsole example included in 3.1.0.Beta3


      I created a controller that has the following:


      @Inject org.jboss.seam.international.status.Messages messages;



      public void save() {
          messages.info("Here is an info message!");
          messages.warn("Here is a warning message!");
          messages.error("Here is an error message!");
      }



      I deployed the project in JBoss AS 7.0.1.Final


      The messages are NOT being displayed in the page.


      If I remove the <h:messages> component from the page, I do NOT even get the WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. warning.

        • 2. Re: Seam 3.1.0.Beta3 Bug - Messages NOT displayed
          Luca Cavagnoli Newbie

          I implemented a surrogate of org.jboss.seam.international.status.Messages as a temporary workaround.




          package org.mydomain.myapp.facesutils;
          
          import static javax.faces.application.FacesMessage.SEVERITY_ERROR;
          import static javax.faces.application.FacesMessage.SEVERITY_FATAL;
          import static javax.faces.application.FacesMessage.SEVERITY_INFO;
          import static javax.faces.application.FacesMessage.SEVERITY_WARN;
          
          import javax.enterprise.context.RequestScoped;
          import javax.faces.application.FacesMessage;
          import javax.faces.context.FacesContext;
          import javax.inject.Named;
          
          /**
           * Since Messages in Seam 3.1.0.Beta is BUGGED, I made mine. 
           * @author luca
           *
           */
          
          @Named
          @RequestScoped
          public class Messages {
          
               public void info(String summary) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setSeverity(SEVERITY_INFO);
                    cxt.addMessage(null, fm);
               }
               
               public void info(String summary, String detail) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setDetail(detail);
                    fm.setSeverity(SEVERITY_INFO);
                    cxt.addMessage(null, fm);
               }
               
               public void warn(String summary) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setSeverity(SEVERITY_WARN);
                    cxt.addMessage(null, fm);
               }
               
               public void warn(String summary, String detail) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setDetail(detail);
                    fm.setSeverity(SEVERITY_WARN);
                    cxt.addMessage(null, fm);
               }
               
               public void error(String summary) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setSeverity(SEVERITY_ERROR);
                    cxt.addMessage(null, fm);
               }
               
               public void error(String summary, String detail) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setDetail(detail);
                    fm.setSeverity(SEVERITY_ERROR);
                    cxt.addMessage(null, fm);
               }
               
               public void fatal(String summary) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setSeverity(SEVERITY_FATAL);
                    cxt.addMessage(null, fm);
               }
               
               public void fatal(String summary, String detail) {
                    FacesContext cxt = FacesContext.getCurrentInstance();
                    FacesMessage fm = new FacesMessage();
                    fm.setSummary(summary);
                    fm.setDetail(detail);
                    fm.setSeverity(SEVERITY_FATAL);
                    cxt.addMessage(null, fm);
               }
          
          }
          



          • 3. Re: Seam 3.1.0.Beta3 Bug - Messages NOT displayed
            Ken Finnigan Master

            Luca,


            This doesn't sound like a problem with the International module, as it doesn't control anything to do with how the messages are displayed in the View layer.


            It's more likely a problem with Faces.

            • 5. Re: Seam 3.1.0.Beta3 Bug - Messages NOT displayed
              Luca Cavagnoli Newbie

              This doesn't sound like a problem with the International module, as it doesn't control anything to do with how the messages are displayed in the View layer.

              It's more likely a problem with Faces.


              Thanks, Jason! It was a problem wirt seam-faces. As a matter of fact, after I added the following dependencies, messages started being displayed.
              Strange how no ClassNotFoundException was being thrown, though...



              <dependency>
                   <groupId>org.jboss.seam.faces</groupId>
                   <artifactId>seam-faces</artifactId>
              </dependency>
              <dependency>
                   <groupId>com.ocpsoft</groupId>
                   <artifactId>prettyfaces-jsf2</artifactId>
              </dependency>




              However, now I get the FacesMessage(s) have been enqueued, but may not have been displayed warning for every message I add, despite there's a <h:messages> in the page.