2 Replies Latest reply on Oct 29, 2009 10:18 AM by nille

    Seam Mail - no status message after catched exception

    nille

      Hi all,


      the problem I have is related to Seam Mail and the following piece of code



      @In     
      protected StatusMessages statusMessages;
      
      @End
      public void save() {
           log.debug("save method start");
           ...
           Renderer renderer = Renderer.instance();
           try {
                log.debug("Sending email...");
                renderer.render("/MyMail.xhtml");
                /* We know there was no failure */
                statusMessages.addFromResourceBundle(StatusMessage.Severity.INFO,Constant.DATA_SUCCESSFUL_SAVED);
           } 
           catch (Exception e) {
                statusMessages.addFromResourceBundle(StatusMessage.Severity.ERROR, Constant.DATA_NOT_SAVED);
                log.error("Exception while sending email: " + e.getMessage());
           }
      }
      


      This code tries to send an email. In case of an exception a message is added. The method is called via an Ajax4JSF Button.



      <a4j:commandButton id="proceed" value="Go" action="#{myAction.save}" />



      If no exception within the renderer happens everything is fine; the status message is displayed via the <rich:messages/> tag.
      But if the renderer throws an exception I see the logging output and the line with the statusMessage.addFromResourceBundel is also executed but the message is not displayed in the browser. In the response the status message is missing.


      Does anybody know what happens (or not happens) here? Or what I'm doing wrong?


      Kind regards,
      Pete