Would I just use <t:messages layout="text"/> in my jsp where layout="text"
would be implemented in my my.package.extend.MyMsgRenderer class that
extends org.apache.myfaces.renderkit.html.HtmlMessagesRenderer?

> -----Original Message-----
> From: Simon Kitching [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 10, 2005 2:29 PM
> To: MyFaces Discussion
> Subject: Re: Messages as text only?
>
>
> Warren Bell wrote:
> > I am kinda playing around with extending
> > org.apache.myfaces.renderkit.html.HtmlMessagesRenderer. I found the
> > renderMessages method and see where I would call a new method that would
> > render the messages the way I want.
> >
> > private void renderText(FacesContext facesContext,
> >                             UIComponent messages,
> >                             MessagesIterator messagesIterator)
> >             throws IOException
> > {
> >   // format messages as text
> >   ...
> > }
> >
> > I am not quite sure how to proceed from there. Would I list the
> new class in
> > the faces-config file like this?
> >
> > <render-kit>
> >     <render-kit-id>textMessages</render-kit-id>
> >
> <render-kit-class>my.package.extend.MyNewHtmlTextMessagesRenderer</render
> > -kit-class>
> > </render-kit>
>
> You don't want to override the *render kit* itself. You want to modify
> the html render kit's configuration. As the html render kit is the
> default render kit, you need:
>
>   <render-kit>
>     <renderer>
>       <component-family>javax.faces.Output</component-family>
>       <renderer-type>
>         org.apache.myfaces.renderkit.html.HtmlMessagesRenderer
>       </renderer-type>
>       <renderer-class>my.package.extend.MyMsgRenderer</renderer-class>
>      </renderer>
>   </render-kit>
>
>
> >
> > And then how would I actually use this in a page? Is there a good
> > tutorial/example of how to do this?
>
> The page doesn't need altering at all, as you haven't changed what JSP
> *tag* is being used, just what renderer is used.
>
> There's no tutorial on overriding renderers as far as I know. Maybe that
> would be a nice addition to:
>    http://wiki.apache.org/myfaces/
> even though it's really generic JSF stuff.
>
> The O'Reilly JavaServer Faces book is pretty good (I'd give it 7 out of
> 10) and does talk about this stuff.
>
> See class UIComponentBase method getRenderer for the real details of how
> a renderer is located for a component.
>
> Regards,
>
> Simon
>
> __________ NOD32 1.1283 (20051110) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>

Reply via email to