You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Randahl Fink Isaksen <ra...@rockit.dk> on 2006/11/07 12:56:30 UTC

"All encoding should be done in encodeEnd()" - Why???

In Sun's own Java EE5 tutorial it says that when developing JSF 
components that have no children you should implement encodeEnd rather 
than encodeBegin:

"The UIComponentBase class defines a set of methods for rendering 
markup: encodeBegin, encodeChildren, and encodeEnd. If the component has 
child components, you might need to use more than one of these methods 
to render the component; otherwise, all rendering should be done in 
encodeEnd"

I have developed a couple of custom UI Components for MyFaces and when 
they don't have children I have used encodeBegin, which according to the 
above quote is not right. Does anyone know why using encodeEnd would be 
more correct / customary?

Randahl