1 Reply Latest reply on Jun 13, 2008 9:32 PM by Guillaume Jeudy

    FacesMessages misbehaving or design limitation ?

    Guillaume Jeudy Master


      I'm using Seam 2.0.1.GA in JBoss 4.2.2 AS. I use FacesMessages.instance().add() to schedule a message to be displayed on the next render phase. The problem is that it only displays on the subsequent render phase not the current phase.

      I refer to organizationalUnits EL in my facelets page. This triggers a factory method in a conversational bean.

      public class ClassificationUseActionBean implements ClassificationUseAction
      public void init() {
               if(condition) {
                FacesMessages.instance().add(FacesMessage.SEVERITY_WARN, warningtxt);

      As I understand this means the message is added during the RENDER phase (where the @Factory code is being executed). Does it mean one should avoid using FacesMessages inside a @Factory method when we know that its being executed in the RENDER phase?

      Are there any workarounds I can use to make it work as intended? Display my message during the current RENDER phase...


        • 1. Re: FacesMessages misbehaving or design limitation ?
          Guillaume Jeudy Master

          Well I guess this FacesMessage business is only intended for use in phases before the RENDER phase.

          I would love to hear there is a workaround because if not I would have to reorganize my app (when needed) to:

          1. Prepare view backing-beans during the INVOKE APP phase (usually through action method execution), create FacesMessages in case of errors during that phase.
          2. View refers to backing beans that are already instantiated, therefore no need to use FacesMessage during that phase.

          FacesMessage properly shows at the top of the page during RENDER phase.

          Please someone tell me I don't have to do that :)