Hi!
I have to customize the way messages are displayed in our current project. Unfortunately the rich:message component doesn't suit our needs. My first problem is finding out how to "replace" the renderer that ships with the 3.x.x richfaces distribution (HtmlRichMessageRenderer).
I'm trying to add the renderer programmatically, but when I use the JSF APIs just to get the current renderer for the family "org.richfaces.component.RichMessage" and renderer-type "org.richfaces.RichMessagesRenderer", I always get null:
FacesContext facesContext = FacesContext.getCurrentInstance(); RenderKitFactory factory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY); RenderKit htmlBasicRenderKit = factory.getRenderKit(facesContext, RenderKitFactory.HTML_BASIC_RENDER_KIT); Renderer messageRenderer = htmlBasicRenderKit.getRenderer(UIMessage.COMPONENT_FAMILY, "javax.faces.Message"); //get the jsf original render Renderer richMessageRenderer = htmlBasicRenderKit.getRenderer("org.richfaces.component.RichMessage", "org.richfaces.RichMessagesRenderer"); //this returns null
I'm assuming if that if the last line of code above returns null, it means that setting the render programmatically on the RenderKit object won't have any effect, since there is no renderer registered with that family and renderer-type, like I thought it should have.
Any ideas?
Ok, I finally noticed my stupid mistake.
The renderer-type I was setting was wrong. It's org.richfaces.RichMessageRenderer
not
org.richfaces.RichMessagesRenderer.