Hello community,

I have a request to make my webapp more MVC friendly in regards of Error-messages.

At the moment we create our error messages in the controller like this:

FacesContext facesContext = FacesContext.getCurrentInstance ();
facesContext.addMessage ( null, new FacesMessage ( FacesMessage.SEVERITY_ERROR, summary, detail ) );

facesContext.renderResponse ();
throw Exception;

In xhtml:

<pf:messages id="msgs" showDetail="true" />

My boss does not like it because it is not true MVC. The controller is JSF independend and it should be exchangable.
Is there a neutral way to add Messages from Java to JSF without using Faces context?

What I found is this: http://static.springsource.org/sprin...l/ch04s13.html Will this work with JSF? Where do I get the MessageContext?

Any help / sample is appreciated.