This probably won't help Warren, but in the interests of completeness
for future readers, here's another option.

If you're using facelets, I think you could simply define another tag
which uses your new renderer.  Ie, messagesAsText in addition to
messages.   I've not tested it, though.

   <tag>
        <tag-name>messages</tag-name>
        <component>
                <component-type>org.apache.myfaces.HtmlMessages</component-type>
            <renderer-type>org.apache.myfaces.Messages</renderer-type>
        </component>
    </tag>

   <tag>
        <tag-name>messagesAsText</tag-name>
        <component>
                <component-type>org.apache.myfaces.HtmlMessages</component-type>
            <renderer-type>mypackage.myRenderer</renderer-type>
        </component>
    </tag>

On 11/10/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
> Warren Bell wrote:
> > I would like to just add another value for an existing property. I have
> > extended the renderer for the messages component. Now I just need the
> > component to use that renderer. And the component to pass to the renderer
> > the new property value. The property is layout and its accepted values are
> > table|list. I want to add 'text' as an additional value. I have included
> > this new value in my new class.
>
> Dang. I didn't read carefully enough. Sorry. As the "layout" attribute
> already exists, you can completely ignore my most recent reply :-(
>
> Yes all you need in the jsp page is:
>    <t:messages layout="text">
> and to configure a new renderer as my first reply showed.
>
> Looks to me like your new renderer will just need to reimplement this
> inherited method (copy/paste/edit):
>      protected void renderMessages(FacesContext facesContext,
>                                    UIComponent messages)
> and add a call to the "renderText" method when layout matches.
>
> Sorry for the confusion.
>
> Regards,
>
> Simon
>

Reply via email to