You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Jesse Alexander (KBSA 21)" <al...@credit-suisse.com> on 2005/03/11 13:47:14 UTC
Decorating a standard component
Hi
I need to decorate the rendering of a standard component (h:inputText).
I thought it should be possible to
- subclass the standard-renderer
- define my renderer in the faces-config.xml in /WEB-INF
Well JSF does not complain, but my own renderer is not called...
renderer:
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
public class InputTextHtmlRenderer extends HtmlTextRenderer {
public void encodeBegin(FacesContext context, UIComponent component)
throws IOException {
// do my stuff
super.encodeBegin(context, component);
}
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
super.encodeEnd(context, component);
// do my stuff
}
}
faces-config.xml:
<faces-config>
<render-kit>
<renderer>
<component-family>javax.faces.Input</component-family>
<renderer-type>javax.faces.Text</renderer-type>
<renderer-class>com.csg.jsf.components.input.InputTextRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>
Somebody an idea / hint?
regards
Alexander
Re: Decorating a standard component
Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
Jesse-
mmm, I think your's looks similar to that
example from David Geary, isn't it?
http://tinyurl.com/4qntr
-Matthias
Jesse Alexander (KBSA 21) wrote:
> Hi
>
> I need to decorate the rendering of a standard component (h:inputText).
>
> I thought it should be possible to
> - subclass the standard-renderer
> - define my renderer in the faces-config.xml in /WEB-INF
>
> Well JSF does not complain, but my own renderer is not called...
>
> renderer:
>
> import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
> public class InputTextHtmlRenderer extends HtmlTextRenderer {
> public void encodeBegin(FacesContext context, UIComponent component)
> throws IOException {
> // do my stuff
> super.encodeBegin(context, component);
> }
> public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
> super.encodeEnd(context, component);
> // do my stuff
> }
> }
>
> faces-config.xml:
> <faces-config>
> <render-kit>
> <renderer>
> <component-family>javax.faces.Input</component-family>
> <renderer-type>javax.faces.Text</renderer-type>
> <renderer-class>com.csg.jsf.components.input.InputTextRenderer</renderer-class>
> </renderer>
> </render-kit>
> </faces-config>
>
> Somebody an idea / hint?
>
> regards
> Alexander
>