7 Replies Latest reply on Jan 2, 2009 2:02 AM by stephen

    Bug in FacesMessage propagation

    wschwendt

      Conversation-scoped component org.jboss.seam.faces.FacesMessages propagates FacesMessages across redirects.  To transfer messages from FacesMessages to the JSF FacesContext, Seam calls FacesMessages shortly before the View is rendered (JSF Render response phase).


      FacesMessage.beforeRenderResponse adds two types of messages to the FacesContext:  Global Messages and keyedMessages, ie. messages associated with a specific component id (NOT clientId)!  It retrieves the list of keyed messages from FacesMessages and tries to convert the component id of a keyed message to a JSF client id.


      However, here is a major bug!  FacesMessage.getClientId() tries to iterate over the JSF view tree in order to find the JSF client id for a given component id.  But the problem is that after a redirect the view tree consists only out of a single UIViewRoot component prior to the Render Response phase!  Therefore, FacesMessages.getCliendId(String componentId) always returns null because the the while condition iter.hasNext() is always false after a redirect.


      Should I file a JIRA issue?


      Conclusion:
      We need something like StatusMessages.addToControl(clientId, severity, msg) rather than addToControl(componentId, severity, msg).



      Regards,


      Wolfgang Schwendt