Nicklas Karlsson wrote:
    It shows up validation errors and what not, but now when I add like
    this in an action method:
    FacesContext.getCurrentInstance().addMessage(componentId, new
    FacesMessage(severity, rawMsg, null));


I think Simon is referring to

http://www.jsf-faq.com/faqs/faces-messages.html#110

I have my generic (not component targeted) messages in a request-scoped messagebean with two lists for messages and errors. But targetting a component from your actions could be a little tricky. Perhaps it could be done with facelets or some other trimmed viewhandler(?)

Thanks for pointing out the existence of that FAQ; I've added a reference to it from the MyFaces FAQ.

I'm not sure that the entry you refer to is correct, though. As far as I know, a new FacesContext is **not** created when a forward is done.

I believe the cause of the problem is exactly as I originally described it: when a validation failure occurs, "actions" associated with the component are not processed at all (unless the component is immediate).

If I'm wrong, corrections would be appreciated.

Regards,

Simon

Reply via email to