2 Replies Latest reply on Jul 20, 2009 3:47 PM by Tomasz Wilczynski

    Add facesMessage from @Factory method.

    Alexandros Karypidis Novice

      Is it possible to add a message to FacesMessages from a @Factory method?


      I have tried using the injected @In FacesMessages but it results in a NullPointerException (apparently factory methods are called before injections).


      I also tried using FacesMessages.instance(), but in this case the message does not show up on the page being rendered. It is queued too late and is therefore shown on the next page.


      So, my problem is that the factory method may be unable to construct the object (data for instantiating it comes over the network and errors may occur when fetching it) and I have no way of communicating any error condition to the user via FacesMessages. Any ideas?