Overriding JSF renders

The main responsibilities of a Renderer consists of generating the appropriate client-side markup, such as HTML, WML, and XUL, and converting information coming from the client to the proper type for the component.

JSF provides a set of built-in renders and has the capability to extend them with custom behavior. If you consider a proper workaround to override a built-in render, then perform the following steps:

  1. Extend the desired built-in renderer (for example, Renderer, TextRenderer, LabelRenderer, MessagesRenderer, and so on).
  2. Override the built-in renderer methods.
  3. Configure the new renderer in faces-config.xml or using the @FacesRenderer annotation.

Well, let's see some examples of writing a custom render. For example, let's ...

Get Mastering JavaServer Faces 2.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.