It depends on the hierarchy of the component tree. Key, are you expecting children? How do you want the encoded output to look when there are children?
Usually you use encodeBegin() if you want to encode the output before the children are encoded. For instance. start tag such as HTML <div> . Usually you use encodeEnd() if you want to encode the output after the children are encoded. For instance. end tag such as HTML </div> . Or perhaps an additional <script> that should work with the previously created <div> .
source share