Monday, March 21, 2011

JSF2 complete reference - again 5 - march21

The result will be that the same Facelet page will
appear differently when viewed in a desktop Web browser and on the Apple mobile device,
as shown in Figure 11-8.
To make this possible, we rely on two basic concepts: a JSF PhaseListener and class
decoration. This example will provide a foundation for a more complete customization,
as well as showing how to automatically deliver a client device–specific CSS style sheet
to the user agent, and allow you to tailor how individual markup elements are displayed.

<lifecycle>
<phase-listener>com.jsfcompref.components.renderer.applemobile.
RenderKitSelectorPhaseListener</phase-listener>
</lifecycle>

The subtlety comes from how we must take
action in the afterPhase( ) method of restore view because this is the earliest time in the
lifecycle when context.getViewRoot( ) returns non-null.

No comments: