If you are creating a custom component, you need to ensure, among other things, that your component class performs these operations:
Decoding: Converting the incoming request parameters to the local value of the component
Encoding: Converting the current local value of the component into the corresponding markup that represents it in the response
The JavaServer Faces specification supports two programming models for handling encoding and decoding:
Direct implementation: The component class itself implements the decoding and encoding.
Delegated implementation: The component class delegates the implementation of encoding and decoding to a separate renderer.
By delegating the operations to the renderer, you have the option of associating your custom component with different renderers so that you can represent the component in different ways on the page. If you don’t plan to render a particular component in different ways, it’s simpler to let the component class handle the rendering.
If you aren’t sure whether you will need the flexibility offered by separate renderers but you want to use the simpler direct-implementation approach, you can actually use both models. Your component class can include some default rendering code, but it can delegate rendering to a renderer if there is one.