Wednesday, June 27, 2007

Reading the JSF spec

Application.getDefaultRenderKit() should (in my opinion) never return null. [pg 231]

Monday, June 25, 2007

JSF component id and clientId

JSF components have a clientId as well as an id.

The id of a component is the id that it chooses to give itself. This may be specified or can also be auto generated by the JSF framework.

The clientId is the id that is transmitted to the web client. For a component, it's clientId is the clientId of the closest parent that implements NamingContainer followed by the JSF seperator char followed by the clientId of this component.

A little code snippet that implements getClientId().



click on the image to get a better view

Monday, June 11, 2007

JSF phase events

The phaseId property of ActionEvent indicates which phase of the request processing lifecycle, this event should be processed.

The broadcast method is called after each phase (where events can be processed). By default it processes all events that have the same phaseId as that of the current phase.

Hence, if we want an event to be processed in a particular phase, we should set the phaseId of the event to the appropriate value, so that the broadcast() method will process it at the correct time.

Do we invoke broadcast manually, or is it invoked when we call super.whatever() in the appropriate phase?

JSF rendererType

The rendererType to use for rendering a JSF component really exists as a property in the component itself. We can call setRendererType(String rendererType); to set the rendererType.

When the component is being rendered, the appropriate renderer will be selected based on the rendererType. The runtime knows which renderer is mapped to a rendererType, because we map it in faces-config.xml. However, it can also be set in code, I believe.

When we use JSP tags to represent JSF components, then the tag handler class can also have a method getRendererType(); which returns the rendererType for that component. This is convenient because the JSF runtime will query the tag handler for the rendererType and will set it in the corresponding JSF component.