Let’s start with a renderer that only
deals with encoding—no decoding. The
only standard renderer for the
(i.e., the component that represents tabular data) is a renderer that
represents the component as an HTML table. Quite often, though, an
application needs to render tabular data horizontally: for instance,
as a navigation bar with page number links to individual pages in a
large query result, as shown in Figure 13-1.
Figure 13-1 shows a new version of the reports list area from the sample application with a page links bar in addition to the first, previous, next, and last page button we used earlier.
To develop and use this custom renderer, there are three things you
must do: implement the renderer class, register the renderer class
with JSF, and implement a JSP custom action that represents a
UIData component equipped with the custom
The new component/renderer combination bound to a data model containing beans representing each report list page can then be added to the original report list area page to renderer the page links bar. Let’s take it step by step, starting with the renderer class.
The links in Figure 13-1 are generated with a
renderer for the
UIData component named
com.mycompany.jsf.render.BarRenderer. Just as for the standard table ...