You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stephen Friedrich <tr...@eekboom.com> on 2008/08/21 23:20:17 UTC

[Trinidad] Triniad 1.2 not using component.encodeAll()

I just tried to create a very simple custom component.
It worked exactly iff the parent component is not a Trinidad component.

Turned out that overwriting encodeAll() has no effect in that case, since
Trinidad's CoreRenderer does not use that method, but rather calls the individual
encodeBegin()/encodeChildren()/encodeEnd() methods itself.

The JSF 1.2 spec says:
"Add new method, encodeAll(), which is now the preferred method for developers to call to
render a child or facet()."

So I think Trinidad's CoreRenderer (in 1.2) should really use this method, right?

Well, ok, IMHO it's a little strange to talk about a "preferred method" in a spec.
I would expect some definitive rules rather than a "would be nice if it were done this way".

Re: [Trinidad] Triniad 1.2 not using component.encodeAll()

Posted by Andrew Robinson <an...@gmail.com>.
encodeAll is a convenience method for renderers to call on their
children, it is not for component authors to extend necessarily.
encodeAll is just a wrapper on the code that is necessary to call
encodeBegin, encodeChildren and encodeEnd.

As the spec says, it is the preferred, not required method, for
developers to *call* (not extend) on child components.

Therefore, Trinidad is compliant with the spec, although not using the
new preferred method.

BTW, why are you overriding an encode method in a component and not in
a renderer? If it is a component that does not render HTML, it would
be best to use either encodeBegin or encodeEnd.

-Andrew

On Thu, Aug 21, 2008 at 3:20 PM, Stephen Friedrich <tr...@eekboom.com> wrote:
> I just tried to create a very simple custom component.
> It worked exactly iff the parent component is not a Trinidad component.
>
> Turned out that overwriting encodeAll() has no effect in that case, since
> Trinidad's CoreRenderer does not use that method, but rather calls the
> individual
> encodeBegin()/encodeChildren()/encodeEnd() methods itself.
>
> The JSF 1.2 spec says:
> "Add new method, encodeAll(), which is now the preferred method for
> developers to call to
> render a child or facet()."
>
> So I think Trinidad's CoreRenderer (in 1.2) should really use this method,
> right?
>
> Well, ok, IMHO it's a little strange to talk about a "preferred method" in a
> spec.
> I would expect some definitive rules rather than a "would be nice if it were
> done this way".
>